Implement restful url in .net where service is implemented using IHTTPHandler?

Your best option is to use URL Rewriting. This is non-trivial in IIS5. The methods I know of are as follows: Method 1 ISAPI filter These are low-level modules that allow you to manipulate the incoming request.

Programming one of these is hairy and tough to debug. If you go this route, you are better off using one that has already been built like ISAPI_Rewrite Method 2 IHttpModule These are managed ASP. Net modules that are easy to add/remove from your application.

Again, you are better off using a pre-built component like UrlRewriter. NET The issue with using one of these, (as BrainLy mentions), is that you have to configure IIS 5 to map all incoming requests to ASP. Net as follows ( link ): Open Up IIS and Navigate to the “Home Directory Tab�

Select “Configuration� Click “Add� And enter “C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.

Dll� In the Executable box. For the file extension, enter “.

*�. Finally, make sure that “Check that file exists� Is not checked One interesting thing to note is that ASP.

Net is itself an ISAPI module :) Once you are able to manipulate URLs using one of these tools, you can easily rewrite the RESTful urls to be handled by your default. Aspx page (or whatever handler you choose to use).

Your best option is to use URL Rewriting. This is non-trivial in IIS5. The methods I know of are as follows: Method 1 - ISAPI filter These are low-level modules that allow you to manipulate the incoming request.

Programming one of these is hairy and tough to debug. If you go this route, you are better off using one that has already been built like ISAPI_Rewrite. Method 2 - IHttpModule These are managed ASP.Net modules that are easy to add/remove from your application.

Again, you are better off using a pre-built component like UrlRewriter.NET. The issue with using one of these, (as BrainLy mentions), is that you have to configure IIS 5 to map all incoming requests to ASP.Net as follows (link): Open Up IIS and Navigate to the “Home Directory Tab� Select “Configuration�

Click “Add� And enter “C:\WINNT\Microsoft. NET\Framework\v2.0.50727\aspnet_isapi.

Dll� In the Executable box. For the file extension, enter “.

*�. Finally, make sure that “Check that file exists� Is not checked.

One interesting thing to note is that ASP. Net is itself an ISAPI module :) Once you are able to manipulate URLs using one of these tools, you can easily rewrite the RESTful urls to be handled by your default. Aspx page (or whatever handler you choose to use).

I have to deploy this at multiple locations using an installer. Many of them will already have some app or website hosted on IIS.So will it be safe to get all the requests routed to ASP. NET?

Really thank you all for responding. – vamyip Jan 20 at 10:43 I believe it is possible to do some automation on IIS using WHS (technet.microsoft. Com/en-us/library/bb727082.

Aspx). Unfortunately, this is out of my area of knowledge. As far as mapping ASP.

Net to all incoming requests, I am almost certain you can do this on a site-by-site basis.So if you are installing at a client who has multiple websites configured, you would only want do to this for your site. – dana Jan 21 at 16:08 Thats great. Can you help me get more information on how to map ASP.NET to all incoming requests on a site-by-site basis?

If that's possible, then I'm almost done. – vamyip Jan 27 at 5:14 Thanks @dana, I was ignoring the option of routing all requests through ASP.NET thinking that it would apply to all the sites hosted on IIS. Since it is possible to do this configuration on site-by-site basis, my problem is solved.

– vamyip Jan 31 at 7:27 @vamyip - Glad you got things figured out and good luck w/ the IIS5 automation. Like I said, it is something I have never done before, but it looks possible using windows script. – dana Jan 31 at 16:24.

If you can allow the restriction of only IIS 7.0 and above you could use URL Rewrite iis.net/download/URLRewrite to do that pretty easily. Can I ask why is it that you need to support IIS 5+? That is an 11 year old technology that hopefully people will move out of those platforms in favor of more recent versions.

Also keep in mind support for some of those platforms is ending pretty soon. If the concern is developers running Windows XP I would point out that IIS Express includes version 7.5+ functionality and is available for all platforms Windows XP and above.

I am of the same opinion as yourself, but, I don't control over requirements :( . So have to find a workaround for this. – vamyip Jan 19 at 4:03.

I think this will be difficult to do because IIS 5 will not let you handle non ASP. NET file extensions without some additional configuration in IIS. That means you are limited to URLs ending in .

Aspx etc. To handle URLs like those in your examples you need to map ASP. NET to handle all URLs in IIS, implement some type of URL rewriting, or introduce some kind of hacky 404 redirection. Once you have the correct mapping in place you can wire up an IHttpHandler, but you will have to parse the incoming request yourself to work out which is /MyService/MyMethod1/ and which is for /MyService/MyMethod2/.

If your methods are simple then it is easy to do this with a regular expression. You should start with a simple handler like this one.

Your best option is to use URL Rewriting. This is non-trivial in IIS5. These are low-level modules that allow you to manipulate the incoming request.

Programming one of these is hairy and tough to debug. If you go this route, you are better off using one that has already been built like ISAPI_Rewrite. These are managed ASP.Net modules that are easy to add/remove from your application.

Again, you are better off using a pre-built component like UrlRewriter.NET. Click “Add” and enter “C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi. Dll” in the Executable box.

For the file extension, enter “. Finally, make sure that “Check that file exists” is not checked. Once you are able to manipulate URLs using one of these tools, you can easily rewrite the RESTful urls to be handled by your default.

Aspx page (or whatever handler you choose to use).

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions