Click here to Skip to main content
15,891,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my app we have login system.after logout in my app i enter url in address bar... how to avoid login using url?
Posted

1 solution

On your Loginpage put this..Madhuuuuuuuuuuuuu

C#
protected void Page_Load(object sender, EventArgs e)
   {
       if (!IsPostBack)
       {
           Response.Cache.SetCacheability(HttpCacheability.NoCache);
           Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
           Response.Cache.SetNoStore();
           Response.Buffer = true;
           Response.ExpiresAbsolute = DateTime.Now.AddDays(-1d);
           Response.Expires = -1500;
           Response.CacheControl = "";
           if (Session["username"] == null)
           {
               Response.Redirect("../Login.aspx");
           }
       }
 
Share this answer
 
Comments
User-11630313 2-Dec-15 5:05am    
its not working for me...in browser error occurred like "The page isn't redirecting properly"
Arasappan 2-Dec-15 5:10am    
Redirect the page properly madhu..
Arasappan 2-Dec-15 5:11am    
Is this go to exception
User-11630313 2-Dec-15 5:59am    
no i redirected correctly..browser shows
The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this address in a way that will never complete.
User-11630313 2-Dec-15 6:01am    
is there any need to add authorization and authentication sections in web.config file

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