Read Tip1 Here
2. Disable Session State
In ASP.NET Session State is on by default for every page . So we need to disable Session State if we are not going to use it. Sessions are created to pass information from one page to other page per user. We do not require Session State when web pages are static or when there is no need to store information captured in the page. Do not use sessions to store Global data that is specific to all users. Session is specific to single user.
We can this off for specific pages, as well as entire page depending on the requirement. Usage of sessions will significantly decrease the performance of the application . So we need to try to minimize the use of sessions in Web Applications. If we are not using Sessions in the application it can be set off in the web.config that applies to entire application.
Otherwise it can be disabled in page level as
<%@ Page language="c#" Codebehind="Form.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.Form" EnableSessionState="false" %>
In web.config we can turn off sessionstatemode under System.Web Section as follows.
<sessionState mode="off"></sessionState>
As all of us know,ASP.NET Manages session state automatically. But if we do not require Sessions, disabling it will help in boosting the performance of the application.
6 comments:
if we are using sessions to decide master pages then is it possible to disable sessions ?
Then you sud n't disable session state at the application level in web.config.
Do you have single base page or multiple pages .
Please do not disable sessions on the page that calls these master pages or in master pages. You can disable sessions in any of the other pages that uses static data and do not really use this session data in those pages. For instance if you do not want data to be transfered to those pages and you are not creating or consuming any sessions in any of the webpages then you can.
In my application all the pages make use of master pages. So I think I cannot disable this.
Does View state of controls have any performance issues ? If so please tell me.
Yes you should not then. Its not best practice to use sessions to load master pages.
As master page (global) is same to all users.
If you have large data as the viewstate is grown then you can compress viewstate.
If You do not need data under postback then you can.
If you have static , readonly controls then you can disable
In master page I am using hyperlinks as menu items. So in each page preint() am checking usertype and calling corresponding master page. Is there any other approach to this as you told its not best practice.
sorry I think I am diverting the actual topic.
sir,i am a new .net developer,i want to do a certification please give me proper guidance.Because i am a begginer shall i Prepair for MCTS 70-536 certification .please reply me.
Post a Comment