angularjs - Accessing HTTP Handler with UI-Router and MVC 5 -
i'm using library submitting "post" request .axd
path in angular application. since using ui-router, seems #/
appended url preventing request reaching dll.
the url needs reached in library is:
http://localhost:8080/myapplication/myarea/modulename#/thermallabelwebeditor.axd?_=1478731762000
however, getting "post" request html data of page. believe symptom of mvc handling path in default manner, searching page matching above url, rather accessing dll.
what trying achieve along lines of
routes.ignoreroute("{*anything}/thermallabelwebeditor.axd/{*pathinfo}");
however, not valid in mvc.
additionally, i've specified in area's web.config
file httphandler
s required library, mainly:
<system.web> <httphandlers> <add path="thermallabelwebeditor.axd" verb="*" type="neodynamic.web.thermallabeleditor.thermallabelwebeditor"/> ... <system.webserver> <handlers> <add name="tlwe" path="thermallabelwebeditor.axd" verb="*" precondition="integratedmode" type="neodynamic.web.thermallabeleditor.thermallabelwebeditor" />
now, know can specify $locationprovider.html5mode(true);
in angular module's configuration. however, avoid doing if @ possible, wouldn't solve problem older, non-html5 browsers have use #
fallback.
how can configure web.config
file area (or entire mvc application) or routeconfig.cs
ensure request thermallabelwebeditor.axd
complete?
i'm using mvc 5, .net 4.6, angular 1.5.8, , ui-router v0.3.1.
after investigation, have determined issue fixable on javascript side. there appears no way iis parse #
in path
section of http handler, use of wildcards. due nature of how #
short-circuit url, iis unable route request http handler, therefore handling response instead standard mvc breaking application. similarly, routes.ignoreroute
, mvc cannot configured interpret #
character.
the solution issue parse url before sending request , removing #
. in place, handler mappings can configured @ route in question myarea/mymodule/httphandler.axd...
, intercept iis before looking through mvc structure.
i should note reason avoiding use of html5 mode in ui-router preserve browser compatibility. if html5 mode enabled, issue fixed html5-compliant browsers. however, non-html5 browsers fallback #
in url, breaking application.
Comments
Post a Comment