Click here to Skip to main content
14,981,532 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want to write below code but there is no master page in my web application.
It is very difficult to write this code at each page.Is there any solution for this.
protected override void OnInit(EventArgs e) {
  ViewStateUserKey = Session.SessionID;
  base.OnInit(e);
}
Posted
Comments
SRS(The Coder) 8-Jul-14 6:24am
   
It seems to be impossible without any master page implementation.

1 solution

You can do one thing. Add a base class in which add this code. Inherit every page from that Base Class.

For example, your code behind class is like inheriting System.Web.UI.Page...
C#
public partial class someClassName : System.Web.UI.Page
{
    //....
}

Instead of the above, you will write...
C#
public partial class someClassName : BaseClass
{
    //....
}
Comments
vishal_h 8-Jul-14 6:21am
   
Thanks,but actually i want to avoid this bcz my application contains 300 pages and i cant do changes in all 300 web pages.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900