简体   繁体   中英

Logging in to my site opens a new tab?

I've been working on my personal website as of late, and even thought it's not a big problem because I'm the only one that sees it, it's annoying nonetheless.

Whenever I go to my login page, it all works fine. If I enter a bad username/password, it will just print a simple text message error(intended). But, if I login correctly, then instead of redirecting to the root of my website as I intend, it will instead create a new tab in firefox and from there it will be in / (which is correct). The problem is why does it create a new tab? I didn't even think forms were capable of such a thing:

My full login page is at http://lastyearswishes.com/login The gist of it is:

<form method="post" target="/login">
    Username: <input type="text" name="username" /> <br />
    Password: <input type="password" name="password" /> <br />
    <input type="submit" name="Submit" />
</form>

And my server side code is also very simple:

if(RouteID=="login"){           
  if(AuthenticationModule.Login(Form["username"],Form["password"],false)){
    //logged in correctly
    Response.Redirect("/"); //just go to the root of my site
  }else{
    Write("You fail at life");
  }
}

« target="/login" » means "open in window named « /login »". If it doesn't exist, a new one is opened. I think you meant to use

<form method="post" action="/login">

HTML Form Element

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM