Reputation: 878
is there a way to redirect to page, after submit a form, and in the redirected page, there will be an message that will be posted only if the user redirected after submut?
example:
If submit a form in the page named "Register.aspx"
I want to redirect to "Login.aspx"
page, and ONLY if I was redirectd after I sign up there will be a message
"You just have to login now".
Is it possible?
Upvotes: 1
Views: 2531
Reputation: 6467
Url Referrer will let you know what page you came from. You can also use query string. It can be done with session, but personally I avoid Session and ViewState at all costs.
Upvotes: 1
Reputation: 2709
To redirect, use:
Response.Redirect("someUri");
Source: http://msdn.microsoft.com/en-us/library/t9dwyts4.aspx
For controlling the message, just use a query string or session variable.
Upvotes: 0
Reputation: 34922
On the Register.aspx page, write the message to Session, then in Login.aspx, check for the Session variable and display the message if it exists and optionally remove the variable from Session to prevent further displays. Alternatively, you could redirect to Login.aspx?showMessage=1 and check for the showMessage variable in the QueryString and display based on that.
Upvotes: 2
Reputation: 14874
Just use a Session key to save the state to know the user when He/She visit the Login page and check if it exists Show the relevant message.
Upvotes: 1