views:

38

answers:

2

Hi,

I have two an action method - > RoleURLManagement

which differs with its input parameter in the get compared to the post so we have

     [AcceptVerbs(HttpVerbs.Get)]
     public ActionResult RoleURLManagement(string id)
     {
     }

and

    [AcceptVerbs(HttpVerbs.Post)]
    public ActionResult RoleURLManagement(aspnet_Roles rt)
    {
    }

The get is bringing back a page based on the id in the URL. The Post should be updating that record.

Now,

this works perfect locally on my machine, But I have deployed it, It does not recognise the Post at all.

Not sure why this is happening, on the view I have a BeginForm posting to this method.

Wow

HTML

<% using (Html.BeginForm("RoleURLManagement", "Role", FormMethod.Post))
    {%>

 <fieldset>
  <%--  <legend>Fields</legend>--%>

    <div class="display-label">ApplicationId</div>
    <div class="display-field"><%: Model.ApplicationId%></div>
    <%: Html.TextBoxFor(model => model.ApplicationId, new {@class   = "RemoveAttribute" })%>

    <div class="display-label">RoleId</div>
    <div class="display-field"><%: Model.RoleId%></div>
    <%: Html.TextBoxFor(model => model.RoleId, new {@class = "RemoveAttribute" })%>

    <div class="display-label">RoleName</div>
    <h1><div class="display-field"><%: Model.RoleName%></div></h1>
  <%: Html.TextBoxFor(model => model.RoleName, new {@class = "RemoveAttribute" })%>
    <%: Html.TextBox("RoleName") %>


    <div class="display-label">LoweredRoleName</div>
    <div class="display-field"><%: Model.LoweredRoleName%></div>
    <%: Html.TextBoxFor(model => model.LoweredRoleName, new {@class = "RemoveAttribute" })%>

    <div class="display-label">Description</div>
    <div class="display-field"><%: Model.Description%></div>
    <%: Html.TextBoxFor(model => model.Description, new {@class = "RemoveAttribute" })%>

</fieldset>


 <div class="siteCheck"> 
 <%=Html.SiteMapCheckBoxManagement("checkManagememt", Model)%>
 <%=Html.TextArea("t")%>
 </div>

 <input type="submit" value="Map Sites to Role" />

 <% } %>
A: 

Somebody HELP !!

Calibre2010
A: 

Hmm... not sure why that isn't work... here are a few stabs at ideas:

1) You aren't passing the id into the post method?

[AcceptVerbs(HttpVerbs.Get)]
public ActionResult RoleURLManagement(string id)
{
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult RoleURLManagement(string id, aspnet_Roles rt)
{
}

2) See if it works when accepting a FormCollection instead of aspnet_Roles: (then get the role based on ID, and do an UpdateModel(role) to apply the changes)

[AcceptVerbs(HttpVerbs.Get)]
public ActionResult RoleURLManagement(string id)
{
}

[AcceptVerbs(HttpVerbs.Post)]
public ActionResult RoleURLManagement(string id, FormCollection form)
{
}

Of course neither of those explain why it works different on your machine than the server. Do you have different versions of IIS? RC of MVC 2?

Good Luck...

Chris
Hmm seems like it still isnt distingushing the Action Names on the webserver
Calibre2010