tags:

views:

67

answers:

2

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.

the LogOn.aspx page code is from the VS2008 mvc applocation template with no modification ,

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>

Log On

Log On

Please enter your username and password. <%= Html.ActionLink("Register", "Register") %> if you don't have an account.

<%= Html.ValidationSummary("Login was unsuccessful. Please correct the errors and try again.") %>

<% 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.

when i submit the LogOn page , a simple page on my local machine all working fine and i and i 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

but when test the production server the page is not being submitted and the AccountController LogOn method is never invoked.

[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");
        }
    }

instead the AccountController LogOn GET method is invoked

public ActionResult LogOn()
    {

        return View();
    }

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
+2  A: 

Just a quick check but has the live server got the .mvc extension registered against ISAPI?

Brian Scott
im running IIS 7.0 - is registration needed ?
soofy
A: 

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. Just modify your logon FORM tag like this:

<form ... method="post">
Hemme
using (Html.BeginForm() handles that
soofy
You are right, I missed the "using" line.
Hemme