[英]ASP.NET 1.0 MVC APPLICATION
using VS 2008 i created a clean asp.net MVC application project and changed nothing , on my computer all works fine.after i uploaded to the server i'm facing a problem. 使用VS 2008,我创建了一个干净的asp.net MVC应用程序项目,未进行任何更改,在我的计算机上一切正常,在我将其上传到服务器后,我遇到了问题。
the LogOn.aspx page code is from the VS2008 mvc applocation template with no modification , LogOn.aspx页面代码来自VS2008 mvc applocation模板,未经修改,
Log On 登入
Please enter your username and password. 请输入您的用户名和密码。 <%= Html.ActionLink("Register", "Register") %> if you don't have an account.
<%= Html.ActionLink(“ Register”,“ Register”)%>(如果您没有帐户)。
<% using (Html.BeginForm()) { %> <div> <fieldset> <legend>Account Information</legend> <p> <label for="username">Username:</label> <%= Html.TextBox("username") %> <%= Html.ValidationMessage("username") %> </p> <p> <label for="password">Password:</label> <%= Html.Password("password") %> <%= Html.ValidationMessage("password") %> </p> <p> <%= Html.CheckBox("rememberMe") %> <label class="inline" for="rememberMe">Remember me?</label> </p> <p> <input type="submit" value="Log On" /> </p> </fieldset> </div> <% } %>
and its working on my local asp.net Dev server and also on a GoDaddy Server, but when i moved it to a new web server it not functioning correctly. 及其在我的本地asp.net Dev服务器和GoDaddy服务器上工作,但是当我将其移至新的Web服务器时,它无法正常运行。
when i submit the LogOn page , a simple page on my local machine all working fine and i and i get : 当我提交LogOn页面时,本地计算机上的一个简单页面运行正常,并且我和我得到:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult LogOn(string userName, string password, bool rememberMe, string returnUrl)
{
if (!ValidateLogOn(userName, password))
{
return View();
}
FormsAuth.SignIn(userName, rememberMe);
if (!String.IsNullOrEmpty(returnUrl))
{
return Redirect(returnUrl);
}
else
{
return RedirectToAction("Index", "Home");
}
}
but when test the production server the page is not being submitted and the AccountController LogOn method is never invoked. 但是在测试生产服务器时,不会提交页面,并且永远不会调用AccountController LogOn方法。
public ActionResult LogOn()
{
return View();
}
instead the AccountController LogOn GET method is invoked 而是调用AccountController LogOn GET方法
Request URL:http://91.202.171.55/$sitepreview/powergroup.co.il/Account/LogOn
Request Method:GET
Status Code:200 OK
Request Headers
Referer:http://91.202.171.55/$sitepreview/powergroup.co.il/Account/LogOn
User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4
Response Headers
Cache-Control:no-cache
Content-Length:2149
Content-Type:text/html; charset=utf-8
Date:Thu, 24 Jun 2010 18:51:43 GMT
Expires:Thu, 24 Jun 2010 18:51:44 GMT
Server:Microsoft-IIS/7.0
X-AspNet-Version:2.0.50727
X-AspNetMvc-Version:1.0
X-Powered-By:ASP.NET
Headers: 头:
Request URL:http://91.202.171.55/$sitepreview/powergroup.co.il/Account/LogOn Request Method:GET Status Code:200 OK Request Headers Referer:http://91.202.171.55/$sitepreview/powergroup.co.il/Account/LogOn User-Agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/533.4 (KHTML, like Gecko) Chrome/5.0.375.70 Safari/533.4 Response Headers Cache-Control:no-cache Content-Length:2149 Content-Type:text/html; charset=utf-8 Date:Thu, 24 Jun 2010 18:51:43 GMT Expires:Thu, 24 Jun 2010 18:51:44 GMT Server:Microsoft-IIS/7.0 X-AspNet-Version:2.0.50727 X-AspNetMvc-Version:1.0 X-Powered-By:ASP.NET
只是快速检查一下,但实时服务器是否已针对ISAPI注册了.mvc扩展名?
It looks like you are submitting the form through a GET request, while the LogOn action method you wanted to invoke is decorated by AcceptVerbs(HttpVerbs.Post), which enables the action method to be called in response to POST requests. 看起来您正在通过GET请求提交表单,而您要调用的LogOn动作方法是由AcceptVerbs(HttpVerbs.Post)装饰的,它可以响应POST请求而调用该动作方法。 Just modify your logon FORM tag like this:
只需像这样修改您的登录FORM标签:
<form ... method="post">
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.