We can write formatted output using Response.Output.Write().
After the Init() and before the Page_Load().
In Server.Transfer page processing transfers from one page to the other page without making a round-trip back to the client’s browser. This provides a faster response with a little less overhead on the server. The clients url history list or current url Server does not update in case of Server.Transfer.
Response.Redirect is used to redirect the user’s browser to another page or site. It performs trip back to the client where the client’s browser is redirected to the new page. The user’s browser history list is updated to reflect the new address.
- Required field Validator
- Range Validator
- Compare Validator
- Custom Validator
- Regular expression Validator
- Summary Validator
Compare Validator control.
ViewState is used to retain the state of server-side objects between page post backs.
ViewState is stored in a hidden field on the page at client side. ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.
They exist for the life of the current page.
stores the session in memory on the web server.
Session state management stores data in an external server. The external server may be either a SQL Server or a State Server. All objects stored in session are required to be serializable for Out-of-Process state management.
Using the Attributes property of server side control.
Caching is a technique used to increase performance by keeping frequently accessed data or files in memory. The request for a cached file/data will be accessed from cache instead of actual location of that file.
ASP.NET has 3 kinds of caching :
- Output Caching,
- Fragment Caching,
- Data Caching.
It caches the portion of the page generated by the request. For that, we can create user controls with the below code:
<%@ OutputCache Duration="120" VaryByParam="CategoryID;SelectedID"%>
Yes. We have to include below mvc assembly references in the web forms application to create hybrid application.
No. The code files must be in same language to be kept in App_code folder.
It is a feature used to secure connection string information.
MailMessage mailMess = new MailMessage ();
mailMess.From = "email@example.com";
mailMess.To = "firstname.lastname@example.org";
mailMess.Subject = "Test email";
mailMess.Body = "Hi This is a test mail.";
SmtpMail.SmtpServer = "localhost";
MailMessage and SmtpMail are classes defined System.Web.Mail namespace.
We can SetNoStore on HttpCachePolicy object exposed by the Response object’s Cache property:
Response.Write (DateTime.Now.ToLongTimeString ());
Client-side validation is the best way to validate data of a web page. It reduces the network traffic and saves server resources.
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
For more questions click here