Use*_*106 19 asp.net-mvc asp.net-web-api
如何在ASP.NET MVC Web API的URL末尾将电子邮件作为参数传递?
如下:
test.com/api/sales/getcustomerorders/test@test.com
Run Code Online (Sandbox Code Playgroud)
我想将电子邮件地址作为参数传递给getcustomerorders操作.
我们可以使用查询字符串传递.但我想像上面那样格式化网址.
谢谢.
这里的问题是你在网址中有句号.
为了使其工作,请更改您的Web配置以添加以下两个配置:
<configuration>
<system.web>
<httpRuntime relaxedUrlToFileSystemMapping="true" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
Haacked有一个关于relexUrlToFileSystemMapping的博客http://haacked.com/archive/2010/04/29/allowing-reserved-filenames-in-URLs.aspx
我在IIS Express 8中有一个关于它的错误,需要runAllManagedModulesForAllRequests:https://aspnetwebstack.codeplex.com/workitem/226
| 归档时间: |
|
| 查看次数: |
15518 次 |
| 最近记录: |