Reputation: 79
I have a Web handler in an ASP.Net project. I want to access it from the URL.
Yes, I can do it like http://mywebsite.com/handler.ashx?id=35157 It works fine.
But the problem is, I'm accessing it from some Arduino devices. Their libraries do not support that kind of URLs.
They support http://mywebsite.com/handler?id=35157 like URLs.
How can I access the web handler from URLs like http://mywebsite.com/handler?id=35157,device=DF,Msg=OK
Without the ASHX extension in it?
Upvotes: 2
Views: 819
Reputation: 2839
You can add a handler in Web.config:
<handlers>
<add name="CustomHandler" path="handler" verb="GET" type="AppCode.CustomHandler" preCondition="integratedMode"/>
</handlers>
Upvotes: 1
Reputation: 35514
You can always use an IIS rewrite rule.
<rule name="Remove ASHX Extension" stopProcessing="true">
<match url="^handler(.*)$" />
<action type="Rewrite" url="handler.ashx{R:1}" />
</rule>
Upvotes: 1