i trying set route mvc controller action following template:
[route("app/{appid:length(20)}/validate/{version}")]
the idea resulting url this: (i'm adding space make localhost url try not resolve...)
http:/ /localhost:2642/api/update/v1/app/6a6ee0b355c34dbfb381/validate/1.0.0.0
the problem have give me 404 error.
if remove route attribute , use built-in mvc routing, works. url is:
http:/ /localhost:2642/api/external/checkforupdate?appid=6a6ee0b355c34dbfb381&version=1.0.0.0
this should work since know nuget has got versions in url's, think use built-in mvc router.
i tried add :regex() markup in template route validate string format, didn't work. if pass in normal string or value such 1_0_0_0 works. thing don't want go through effort manipulate version string before sending api , in api itself.
any ideas on doing wrong?
if make routing attribute
[route("app/{appid:length(20)}/validate/{version:regex(^([1-9]\\d+|[0-7])(\\.\\d{1,3}){0,3}$)}")]
and make sure accept parameters in method
public task<ihttpactionresult> get(string appid, string version) { //magic }
then in web.config, system.webserver > handlers section change *.
*
<add name="extensionlessurlhandler-integrated-4.0" path="*." verb="*" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" />
to
<add name="extensionlessurlhandler-integrated-4.0" path="*" verb="*" type="system.web.handlers.transferrequesthandler" precondition="integratedmode,runtimeversionv4.0" />
and make sure
<modules runallmanagedmodulesforallrequests="true">
exists in <system.webserver>
Comments
Post a Comment