Question : Response.Redirect is not working properly in the server?

Hai,
  I had developed a web application in C#ASP.net 1.1 framework.The application has several pages.Some pages has Ajax code using javascript.
   I had a login page and in that login page there is a asp:imagebutton and its click event I had validate the user id and password and it is correct, it redirects to another page by this code "Session["UserID"]=txtID.Text;"  2nd line   "Response.Redirect("PageB.aspx")" .
   In PageB,Page load I had checked with this code
"if(Session["UserID"] == null)
{
  Response.Redirect("login.aspx");
}
else
{  part I had given the PageB requirement   }  "
  A few days ago, the below problem is occured before this it was working properly.  
  My Problem is,In login.aspx page I had clicked the imagebutton with all requirement but It wont redirect to PageB and remains on login page itself.This problem occurs only in server and in local it works perfectly.
   No error occur in server also but it didnot redirect to PageB.
   After 2 to 5 times,I had login it redirect to PageB in server.
  How to solve this type of problem?
  Plz give me a solution to solve this problem...........

Answer : Response.Redirect is not working properly in the server?

For the sake of debuging, Instead of Redirecting, Try displaying the content of your Session["UserID"] variable in order to validate that it was properly assined the txtID.Text.

This will reduce the the area of searching in order to resolve your issue.

Also, Make sure Session["UserID"] is properly Initialize before trying to use it.

Random Solutions  
 
programming4us programming4us