0

I have a page called: Welcome.aspx

In the page load of that page I did: Response.Redirect("Welcome.aspx?First=true")

So when I visit Welcome.aspx the site keeps redirecting and it doesn't stop (logical).

What can I do to stop the redirecting? I just want that the redirect happens just once. So when someone visits Welcome.aspx they must be redirected to Welcome.aspx?First=true just once. And after that the response.redirect must stop.

Thanks!

4

1 回答 1

3

仅当 QueryString["First"] 不等于 "true" 时才进行重定向(尽管我认为您的命名和逻辑在那里并不真正匹配)。就像是:

void Page_Load( ... )
{
    if (!Page.IsPostBack)
    {
        if (QueryString["VisitFlag"] == null)
            Response.Redirect("Welcome.aspx?VisitFlag=Done");
    }
}
于 2013-07-12T17:53:56.957 回答