我正在使用向我的Angular应用程序中的.axd
路径提交“POST”请求的库。由于我使用的是UI-Router,因此附加到URL的似乎阻止了请求正确到达DLL。使用UI路由器和MVC访问HTTP处理程序5
需要在图书馆要达到的网址是:
http://localhost:8080/MyApplication/MyArea/ModuleName#/ThermalLabelWebEditor.axd?_=1478731762000
然而,所有我得到这个“POST”请求,背面是页面的HTML数据。我相信这是MVC的一种症状,它以默认方式处理路径,搜索与上述URL匹配的页面,而不是访问DLL。
我所试图实现的是沿
routes.IgnoreRoute("{*anything}/ThermalLabelWebEditor.axd/{*pathInfo}");
线的东西。然而,这是不是在MVC有效。
此外,我在我区的Web.config
文件已指定该库所需的httpHandler
S,主要表现在:
<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" />
现在,我知道我可以在我的角度模块的配置指定$locationProvider.html5Mode(true);
。但是,如果可能的话,我想尽量避免这样做,因为它不能解决必须使用#
回退的较老的非HTML5浏览器的问题。
如何配置我的Web.config
该区域(或整个MVC应用程序)文件或RouteConfig.cs
以确保ThermalLabelWebEditor.axd
的请求将成功完成?我使用的是MVC 5,.NET 4.6,Angular 1.5.8和UI-Router v0.3.1。