Reputation: 1989
I have a asp.net MVC with Razor site that works fine on my PC and our company's test server. However, on the client's web server it gets "stuck" on the login page. I can't debug the site on the client's server (they don't have Visual Studio) and I can't duplicate the problem anywhere else. Any suggestions on how to find the problem? Also, any idea what the problem might be?
So I have a login page where the user enters their user name and password and clicks a "sign in" submit button. When they click submit, the browser gets "stuck"; that is the the "working" icon spins (I'm using Chrome) while at the bottom of the page it shows the message "waiting on {site name}...".
Here's some code from the view:
@using (Html.BeginForm("Login", "Admin", FormMethod.Post))
{
<label>
<b>Username</b>
</label>
@Html.TextBoxFor(m => m.UserName, new { @class = "span12" })
<span class="validation">@Html.ValidationMessageFor(m => m.UserName)</span>
<label>
<b>Password</b>
</label>
@Html.PasswordFor(m => m.Password, new { @class = "span12" })
<input id="Submit1" type="submit" value="Sign In" class="btn btn-primary pull-right" />
}
Here's a portion of the controller. I left out some error handling, but you'll get the idea that it's a simple "check if username and password exists" operation.
[HttpPost]
public ActionResult Login(ModelAdminLogin Model)
{
if (ModelState.IsValid)
{
LoginResponse Res = obj_bllCA.Login(Model.UserName, Model.Password);
if (Res.LoginStatus)
{
return RedirectToAction("Index");
}
}
return View(Model);
}
On the login page, after enter login information and clicking sign in, it "spins" for a few minutes and then shows a page not found message:
Strangely, if you then click refresh, it shows the correct page with the user logged in.
Again, on my PC in Visual Studio and my company's web server, the login process works fine. The user enters the username and password, clicks Sign In, and it takes them to the next page. Only on the client's server does it instead go to the missing page.
UPDATE #1
Using Fiddler, I got this error message to display:
ReadResponse() failed: The server did not return a complete response for this request. Server returned 0 bytes.
Using the Chrome tools, I can see it stalls after the submit button is clicked:
It looks like it's not posting to the controller. Anyone have a suggestion on how to fix this?
Upvotes: 1
Views: 1458
Reputation: 1
I had lowercase characters
.../student/create
instead of uppercase characters
.../Student/Create :0)
Upvotes: 0
Reputation: 1989
The answer turned out to be that the client had set up the site in IIS to be a secure site. I had to use https://sitename.com instead of sitename.com or http://sitename.com. Once I did that, all the pages worked. I don't understand why the original page worked without the https or why hitting refresh showed the correct page without the https, so if anyone has any input on that please let me know. Otherwise the https was the whole problem.
Upvotes: 0
Reputation: 2807
Based on ReadResponse error, it seems like it is an IIS configuration issue:
In general:
Upvotes: 1
Reputation: 54638
How do I diagnose why an asp.net MVC site works on one server but not another?
Using chrome dev tools you can diagnose why something isn't working:
Internal server error: (In this case a 500 internal server error)
You can click on the specifc request and then click the preview to get the details:
Upvotes: 3