asp.net - Choose postback URL of according to situation -


I control if a user is present in the database, if it does not exist, I want to be the login page. If it exists, then I want to go to the default .aspx page.

  Protected Zero BtnLogin_Click (Object Sender, EventArgs E) {If (the situation is OK) {// go default.aspx} else {// Make this page}}  < / Pre> 

What can I write on the comment line to get it? Thanks!

Looks like you want to redirect:

  protected Zero BtnLogin_Click (object sender, EventArgs e) {if (myCondition) {Response.Redirect ("/ default.aspx"); } Other {// stop this page}}  

If you want to keep post data, you can use Server.Transfer instead (Note: editing, it does not this way you need it - I think you just need feedback. Redirex :

< Pre server transfer ("/ default.aspx");

Note that transferring the handler of such a post does not not Browse one Will cause redirects and therefore not will replace the browser URL

If you really need to post a different URL and there is a browser update, then you can send the URL directly Post a post-page postback (using action ). Attribute on the form element), validate on that page and then redirect back to the original page if the verification fails.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -