Response.Redirect and back

287 views Asked by At

My main page is Default.aspx.

When i navigate to it, in global.asax file, Session_Start method, i'm checking for some conditions, and if those are not met, i need to redirect to another page, Admin.aspx. I do that by calling

Response.Redirect("Admin.aspx");

From that page (after setup is done), i would like to be able to navigate back to the original page, Default.aspx, by calling

Response.Redirect("Default.aspx");

But that doesn't happen, Admin.aspx gets reloaded.

By examinig with Fiddler, i saw that the page Default.aspx is indeed being requested, but instead of the page content, i got "Object moved", so i'm being redirected back to Admin.aspx.

How can i get to my original location after Response.Redirect has been called? Is there an alternative to it?

P.S. Response.Redirect() is not inside try..catch block

Thank You!

EDIT: Global.asax:

protected void Session_Start(object sender, EventArgs e)
    {
        ...
        ...
        ...
        ...
        ...

        bool setupComplete = bool.Parse(ConfigurationManager.AppSettings["SetupComplete"]);

        if (!setupComplete)
        {
            Response.Redirect("~/Admin.aspx");
        }
    }

SetupComplete is being set to true in the admin page.

0

There are 0 answers