admin管理员组文章数量:1289496
I am using ASP.NET and C#.In register page after click on submit i am storing all the details in database and redirecting to login page.So in login page i need to display message like successfully registered.
Can someone tell me is it possible?
Thanks.
I am using ASP.NET and C#.In register page after click on submit i am storing all the details in database and redirecting to login page.So in login page i need to display message like successfully registered.
Can someone tell me is it possible?
Thanks.
Share Improve this question asked Sep 22, 2012 at 9:05 GiriGiri 94112 gold badges31 silver badges51 bronze badges 1- there are several ways of passing variables between pages. Take a look at this msdn article for code samples: msdn.microsoft./en-us/library/6c3yckfw(v=vs.100).aspx – MUG4N Commented Sep 22, 2012 at 9:13
5 Answers
Reset to default 2You may use Session, QueryString, Cookie for this purpose.
But I would suggest show you message on same Register page. And put continue button on page, that will redirect user to Home or other page.
Why I`m saying show message on same page, because one thing is fixed you are going to redirect user if registration was successful, if not you will show the errors.
Session, QueryString will be easy and handy option for this:
Session["RegisterMessage"] = "Hello User, You have successfully registered";
Or
Response.Redirect("Home.aspx?msg=Hello User, You have successfully registered");
You may show this value on label on the page.
Use Query String to pass the Message to Login Page and show with the help of Label.
You can create a label on the login page and once you response.redirect the user to the login page, you can pass a session or querystring on the fact that they have successfully registered.
On the login page, on the onload event handler, check if the querystring / session contains whatever you inserted, if it has, display the message in the label, else disregard.
After you have registered the user successfully, use
Response.Redirect("YourLoginPage.aspx?status=registered");
and in YourLoginPage.aspx
page,
string strStatus = Request.QueryString["status"].ToString();
if(strStatus.ToUpper()=="REGISTERED")
Response.Write("You are registered successfully"); // or place it in any label.
In case you want to login him at the same time, you can user Session
to store authentication details and call login method, at the same time.
You should store message or information in session or on page of login.
On page load check if the session or message is not empty then display message via alert box using javascript.
本文标签: cHow to display response message after redirecting to otherpageStack Overflow
版权声明:本文标题:c# - How to display response message after redirecting to otherpage? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741478567a2381029.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论