1. In what instances you will declare a constructor to be private?
Ans. When we create a private constructor, we cannot create object of the class directly from a client. So you will use private constructors when you do not want instances of the class to be created by any external client. Example UTILITY functions in project will have no instance and be used without creating instance, as creating instances of the class would be waste of memory.
2. In which event are the controls fully loaded?
Ans. Page_load event guarantees that all controls are fully loaded. Controls are also accessed in Page_Init events but you will see that viewstate is not fully loaded during this event.
3. How to make security check by an administrator that no one has tampered with ViewState?
Ans. Using the @Page directive EnableViewStateMac to True.
4. What is the use of @ Register directives?
Ans. @Register directive informs the compiler of any custom server control added to the page.
5. What’s the use of SmartNavigation property?
It’s a feature provided by ASP.NET to prevent flickering and redrawing when the page is posted back.
Note:- This is only supported for IE browser. Project’s who have browser compatibility as requirements have to think some other ways of avoiding flickering.
6. Where is ViewState information stored?
Ans. In HTML Hidden Fields.
7. What is AppSetting Section in “Web.Config” file?
Ans. Web.config file defines configuration for a webproject. Using “AppSetting” section we can define user defined values. Example below defined is “ConnectionString” section which will be used throughout the project for database connection.
<add key="ConnectionString" value="server=xyz;pwd=www;database=testing" /> </appSettings>
9. What is impersonation in ASP.NET ?
Ans. By default, ASP.NET executes in the security context of a restricted user account on the local machine. Sometimes you need to access network resources such as a file on a shared drive, which requires additional permissions. One way to overcome this restriction is to use impersonation. With impersonation, ASP.NET can execute the request using the identity of the client who is making the request, or ASP.NET can impersonate a specific account you specify in web.config.
10. Can we have different access modifiers on get/set methods of a property ?
Ans.No we can not have different modifiers same property. The access modifier on a property applies to both its get and set accessors.