cookieTimeout="20000" cookiePath="/" cookieRequiresSSL="false"
cookieSlidingExpiration="true" cookieprotection="Encryption"
cookieless="User"/>
Question - 104 : - What is Form-Based Authentication?
Answer - 104 : -
Form-Based authentication is used to edit the web configuration files and add a login page to authenticate. It is used for web applications.
Form-based authentication also provides a way to handle authentication using custom logics in ASP.NET applications.
Question - 105 : - Define Configuration files?
Answer - 105 : -
Configuration files help to manage the settings of a website. Settings of configuration files are stored as XML files which are separate from the application.
Configuration files are two types:
- Web Configuration: It contains the machine-specific value for all settings of the application.
- Machine Configuration: It helps to extend, restrict and override the settings.
Question - 106 : - List different types of cookies used in ASP.NET
Answer - 106 : -
Cookies are a small piece of information stored at the client side.
The cookies in ASP.NET are divided into two types:
- Session Cookie: valid for a single session.
- Persistent Cookie: valid for multiple sessions.
Question - 107 : - Write code to send e-mail from an ASP.NET application?
Answer - 107 : -
MailMessage mailMess = new MailMessage ();
mailMess.From = "abc@gmail.com";
mailMess.To = "xyz@gmail.com";
mailMess.Subject = "Test email";
mailMess.Body = "Hi This is a test mail.";
SmtpMail.SmtpServer = "localhost";
SmtpMail.Send (mailMess);
MailMessage and SmtpMail are classes defined System.Web.Mail namespace.
Question - 108 : - How can we prevent browser from caching an ASPX page?
Answer - 108 : -
We can SetNoStore on HttpCachePolicy object exposed by the Response object’s Cache property:
- Response.Cache.SetNoStore ();
- Response.Write (DateTime.Now.ToLongTimeString ());
Question - 109 : - What is the good practice to implement validations in aspx page?
Answer - 109 : -
Client-side validation is the best way to validate data of a web page. It reduces the network traffic and saves server resources.
Question - 110 : - What are the event handlers that we can have in Global.asax file?
Answer - 110 : -
Application Events: Application_Start , Application_End, Application_AcquireRequestState, Application_AuthenticateRequest, Application_AuthorizeRequest, Application_BeginRequest, Application_Disposed, Application_EndRequest, Application_Error, Application_PostRequestHandlerExecute, Application_PreRequestHandlerExecute,Application_PreSendRequestContent, Application_PreSendRequestHeaders, Application_ReleaseRequestState, Application_ResolveRequestCache, Application_UpdateRequestCache
Session Events: Session_Start,Session_End