Today I've been trying to solve the strangest behavior ever.. This simplified piece of code gets executed after I submit a form with only a login and password. The strange thing is that when the password contains an @ the RedirectToAction hangs indefinitely
and when I use a password without an @ It works fine.
[HttpPost] public ActionResult Index(FormCollection collection) { var login = collection["txtLogin"]; var password = collection["txtPassword"]; return RedirectToAction("Index", "Password"); }
Some sites restrict special character usage in a password. I am sure you have encountered it. Maybe should filter the password usage to not accept an @ sign.
If you find the post has answered your issue, then please mark post as 'answered'.
I cannot reproduce your problem based on the code you currently provide. You can
provide more code if it is convenient for you.Or you can
give a screenshot of the error so that we can better help you.
Best Regards,
YihuiSun
ASP.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
I have create a small MVC site from a default template and It behaves the same way. So just create a new web application in Visual Studio and in the HomeController place this extra method
[HttpPost] public ActionResult Index(FormCollection collection) { var login = collection["txtLogin"]; var password = collection["txtPassword"];
And now you may login with whatever name and a password with an @ in it and you will see a hanging site. When you don't use a @ you will be redirected to te contact page
Some sites restrict special character usage in a password. I am sure you have encountered it. Maybe should filter the password usage to not accept an @ sign.
Yeah but that would be putting u bucket on the floor when the roof is leaking.. I want to be able to use an @ in a password.. And what if other characters cause something similar? I would like to find out why this hangs..
I am now talking to another developer in my company and he was running the same simple website and the problem did not occur.. So let me figure out what is different on my computer and his.. Will try some cache deleting, other browser etc.. But this is very
strange behavior I never say before.
Looks like a problem with the Chrome password save mechanisme. I used a real login and password of an existing survey that was saved before and I think that somehow that is the culprit. When I used a new login and password (also with an @ in it) the redirect
functioned as expected. When I deleted all saved passwords the problem also disappeared. Also when debugging in other browsers the problem did not appear.
None
0 Points
5 Posts
RedirectToAction hangs indefinitely
Aug 07, 2020 04:15 PM|edwinhebbink|LINK
Dear all,
Today I've been trying to solve the strangest behavior ever.. This simplified piece of code gets executed after I submit a form with only a login and password. The strange thing is that when the password contains an @ the RedirectToAction hangs indefinitely and when I use a password without an @ It works fine.
[HttpPost]
public ActionResult Index(FormCollection collection)
{
var login = collection["txtLogin"];
var password = collection["txtPassword"];
return RedirectToAction("Index", "Password");
}
Is there anyone who has any idea??
Contributor
4973 Points
4262 Posts
Re: RedirectToAction hangs indefinitely
Aug 07, 2020 09:22 PM|DA924|LINK
Some sites restrict special character usage in a password. I am sure you have encountered it. Maybe should filter the password usage to not accept an @ sign.
All-Star
53661 Points
24020 Posts
Re: RedirectToAction hangs indefinitely
Aug 07, 2020 09:31 PM|mgebhard|LINK
I cannot reproduce this behavior. Share all the relevant code if you still need help.
Contributor
3030 Points
861 Posts
Re: RedirectToAction hangs indefinitely
Aug 10, 2020 07:20 AM|YihuiSun|LINK
Hi edwinhebbink,
I cannot reproduce your problem based on the code you currently provide. You can provide more code if it is convenient for you.Or you can give a screenshot of the error so that we can better help you.
Best Regards,
YihuiSun
None
0 Points
5 Posts
Re: RedirectToAction hangs indefinitely
Aug 10, 2020 12:32 PM|edwinhebbink|LINK
I have create a small MVC site from a default template and It behaves the same way. So just create a new web application in Visual Studio and in the HomeController place this extra method
[HttpPost]
public ActionResult Index(FormCollection collection)
{
var login = collection["txtLogin"];
var password = collection["txtPassword"];
return RedirectToAction("Contact", "Home");
return View();
}
Then in the Home/Index view place this login form
<div class="col-md-4">
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
@Html.ValidationSummary(true)
<div class="form-group">
<label for="inputLogin">Login</label>
<input type="text" class="form-control" id="inputLogin" name="txtLogin" value="SURVEY-">
</div>
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" class="form-control" id="inputPassword" name="txtPassword" placeholder="Password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
}
</div>
And now you may login with whatever name and a password with an @ in it and you will see a hanging site. When you don't use a @ you will be redirected to te contact page
None
0 Points
5 Posts
Re: RedirectToAction hangs indefinitely
Aug 10, 2020 12:33 PM|edwinhebbink|LINK
Some sites restrict special character usage in a password. I am sure you have encountered it. Maybe should filter the password usage to not accept an @ sign.
Yeah but that would be putting u bucket on the floor when the roof is leaking.. I want to be able to use an @ in a password.. And what if other characters cause something similar? I would like to find out why this hangs..
None
0 Points
5 Posts
Re: RedirectToAction hangs indefinitely
Aug 10, 2020 01:08 PM|edwinhebbink|LINK
I am now talking to another developer in my company and he was running the same simple website and the problem did not occur.. So let me figure out what is different on my computer and his.. Will try some cache deleting, other browser etc.. But this is very strange behavior I never say before.
None
0 Points
5 Posts
Re: RedirectToAction hangs indefinitely
Aug 10, 2020 01:20 PM|edwinhebbink|LINK
Looks like a problem with the Chrome password save mechanisme. I used a real login and password of an existing survey that was saved before and I think that somehow that is the culprit. When I used a new login and password (also with an @ in it) the redirect functioned as expected. When I deleted all saved passwords the problem also disappeared. Also when debugging in other browsers the problem did not appear.