Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
In Localhost both buttons are redirect to their returnURL after successfully loggedin but when I put it into online server the first button code working but the second button doesnot redirects to Education.aspx page & show some error?

C#
protected void btnProfile_Click(object sender, EventArgs e)
{
    if (Session["EmailId"] != null && Session["Pwd"] != null)
    {
        Response.Redirect("Profile.aspx");
    }
    else
    {
        Response.Redirect("LogInUser.aspx?ReturnUrl=Profile.aspx");
    }
}
protected void btnEducation_Click(object sender, EventArgs e)
{
    if (Session["EmailId"] != null && Session["Pwd"] != null)
    {
        Response.Redirect("Education.aspx");
    }
    else
    {
        Response.Redirect("LogInUser.aspx?ReturnUrl=Education.aspx");
    }
}
Posted
Comments
ZurdoDev 29-Oct-14 8:02am    
You should be using ~ in your redirects. Not sure if this has anything to do with the problem but try

Response.Redirect("~/Education.aspx"), etc. ~ puts the path back to the root otherwise you have a relative path.

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