ASP.NET MVC Html.BeginForm decodes URL -


i'm requesting asp.net mvc controller using url this:

http://mysite.com/controller/myaction/invalid%23name%25x 

where invalid%23name%25x parameter

public actionresult myaction(string id) {   return view(); } 

the request works fine.

myaction view looks this:

@using (html.beginform()) {    ...    <input name="save" type="submit" value="save" /> } 

the generated html is:

<form action="/controller/myaction/invalid#name%x" method="post">     ...     <input name="save" type="submit" value="save" /> </form> 

when click on "save", form gets posted , post request goes

http://mysite.com/controller/myaction/invalid#name%x 

i.e. initial url decoded. means the post action receives first part of parameter - "invalid"

[httppost] public actionresult myaction(string id, ...) {   return view(); } 

how can prevent html.beginform decoding initial urls in order preserve initial state?

try this, pass actionname , controller in form

@using (html.beginform("actionname", "controller")) { 

Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -