c# - HTML form post to asp.net controller across domains -
i've created asp.net mvc 5 web application must receive post external site (within same corporate intranet). i've set controller method , created web application simulate post. posting page form looks this:
<form action="http://localhost:12345/home/methodname" method="post"> <input type="text" id="fullname" value="joseph b. blow" /> <input type="text" id="dateofbirth" value="3/4/1977" /> <input type="submit" value="submit" /> </form>
i start "receiver" app in debug mode , set break point on first line in "/home/methodname" , breakpoint hit. methodname
looks this:
[httppost] [validateinput(false)] public actionresult methodname() { ...code here }
when check request.form
object in methodname
, it's empty. using developer tools in browser content-length 0. i've tried creating custom model class has properties fullname
, dateofbirth
, using sole parameter in methodname
properties of object null. tried use formcollection
object, contained no keys. attempt made use streamreader
object , use on request.inputstream
object see if pull posted values in.
i might consider using ajax call post data issue user must redirected page. there company security policy against not using querystring pass data site-to-site (i know, post isn't more secure get, dems rules).
this doesn't seem should hard i'm having bear of time it. if has done similar or point me in direction these values passed 1 page another, appreciate it.
thanks in advance.
i'm big dummy. had work include name attribute in form inputs, controller see values. in other words instead of
<input type="text" id="fullname" value="joseph b. blow" />
i changed
<input type="text" name="fullname" value="joseph b. blow" />
only reason i'm exposing myself complete tool in hopes else may having same issue.
Comments
Post a Comment