c# - Ajax.BeginForm absolute url MVC CORS -
is there way ajax.beginform output absolute url rather relative one?
i trying forms working cors on site hosted on server. @ moment parsing form jquery onsuccess in ajax options.
i not pointers tutorial on writing extension handy
is there way ajax.beginform output absolute url rather relative one?
yes, need specify url
in ajaxoptions
, not use overload takes action , controller names:
@using (ajax.beginform(new ajaxoptions { url = url.action("foo", "bar", null, "http") })) { ... }
url.action
has overload specify protocol used generates absolute urls. , if wanted use same protocol 1 used request current action instead of hardcoding use following:
@using (ajax.beginform(new ajaxoptions { url = url.action("foo", "bar", null, request.url.scheme) })) { ... }
Comments
Post a Comment