First, write code in JS
Protected void page_load (Object sender, eventargs E)
{
Ajaxpro. Utility. registertypeforajax (typeof (qlflow ));
If (! Ispostback)
{
Page. registerstartupscript ("", "<SCRIPT> loginfun (); </SCRIPT> ");
// Receive the value from the previous page
If (request. querystring ["proid"]! = NULL | request. querystring ["proid"]! = "")
{
Tmpid. value = request. querystring ["proid"];
INAME. value = request. querystring ["INAME"];
}
}
}
// Whether to log on and verify function loginfun () {var cookie = document. cookie. split (','); If (cookie = NULL | cookie = "") {window. location. href = "login. aspx ";}}
Type 2: write this on each page
protected void Page_Load(object sender, EventArgs e)
{
object obj = Request.Cookies["username"];
if (obj == null)
{
Response.Redirect("Login.aspx");
}
}
Type 3: Write the simplified version of Type 2 in a single aspx file.
Http://support.microsoft.com/kb/224363/zh-cn
object obj = Request.Cookies["username"];
if (obj == null)
{
Response.Redirect("Login.aspx");
}
Then reference each page
protected void Page_Load(object sender, EventArgs e)
{
Server.excute("sessinostate.aspx")
}
Of course there are better ways
Http://space.itpub.net/12639172/viewspace-673140 back to study my project for the second kind would like to use another method unfortunately don't want to change