Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Restfull urls for ASP.NET page on IIS

Ok I had a huge Issue giving this a proper title, my excuses for that.

Anyways I have started slowly to look at Web and ASP.NET again, I am a C# developer but I have mostly worked with Windows applications the past 5 years or so, It is not that I haven't touched the web as such in that time, but this is as web services (Restfull as well as the ugly SOAP services) I have also worked with more "raw" web requests.

But I have not worked with IIS or ASP.NET in all that time.

What I would like to do is hos a web page that uses a URL style I could best describe with "like rest", hence the "Restfull urls" title. Because I think most people thinks of such URL's in terms of:

http://example.com/item/
http://example.com/item/23/

and so forth. Not that they have to look like that, however I would like to use such URL's instead of

http://example.com/item?id=23

I know subtext does this, but i have not had any luck finding it in their code base.

Now as far as I can tell I could just implement some IHttpHandler's, but at least for the examples I have seen of that, they write the page source back in code, and I still have master pages etc. I wish to use instead of taking over all that stuff my self, I really just kinda wants to route http://example.com/item/23/ to http://example.com/item and asking for the item with id 23...

I hope this makes sense at all >.<... And that someone has some better examples at hand that what I have been able to find.

like image 641
Jens Avatar asked Jan 17 '23 17:01

Jens


1 Answers

You can achieve this using Routing here is a link to an MSDN blog, The .Net Endpoint - Using Routes to Compose WCF WebHttp Services that should get you started.

like image 130
Lloyd Avatar answered Jan 20 '23 08:01

Lloyd