tags:

views:

272

answers:

3

I am wondering how one goes about creating/rerouting my custom developed .ASPX pages on IIS 6.0 pages to something totally custom w/o the .aspx extension, say, .vato? For example, instead of my page saying: Default.aspx?ID=123, I would like users to see: Default.vato?ID=123.

What concept is? Is this doable? Where can I research more on this topic?

+1  A: 

Yeah, read this:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/4c840252-fab7-427e-a197-7facb6649106.mspx?mfr=true

Create a new entry for your new extension and map it to the same executable as the .aspx handler.

The common one is to add a wildcard. This allows you to have URLs without extensions at all. IMO, that's much preferred because extensions make little sense on the internet.

Oli
A: 

In IIS (6.0) click on "Configuration" on your Web Site page and you can add mappings there. It must reference the same ASP.NET ISAPI DLL as for example the ASPX pages.

You can also add * and have all requests route to a HTTP module but that's a little more advanced and useful for the likes of REST.

Lloyd
+1  A: 

It's not so much a .net question as it is an IIS question.

Basically, IIS looks at what extension is being requested and responds accordingly.

There is a list of all file extensions and what actions should be taken when these are requested. In terms of .net, these are .aspx, .ascx, asmx, etc. These are basically ISAPI filters.

Depending on your version of IIS. If you open IIS Manager, choose the website in question, go to Properties, then Home Directory, then Configuration, under Mappings you will see all file extensions and the application that will be called to action this request.

Therefore, if you add an entry for .vato, and point it to your version of .net, such as C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll then the .vato file will then be treated the same as a .aspx files.

Robin Day
Thanks for your reply - I had a deployed application and went into IIS and entered .vato as an extension, but when I visited the site, for example: Default.vato?ID=123, I got a 404.If I go to Default.aspx?ID=123, it still works. Why doesn't my .vato work?
Do you have a Default.vato file? If not, another problem may be that you have to assign a MIME type to the file so that IIS doesn't consider it an unknown threat.
Robin Day
That's just it - I guess I don't understand this concept all that well. All of my pages are .ASPX pages and that is why I thought maybe I thought I had to change something to my code, but then you guys informed me that it's all via an IIS configuration. So, I have to change my extensions as well for my .aspx pages? Sorry for my ignorance and thanks for the assistance!
It's quite hard to explain. Basically, .html files are spat out to the client directly. You don't want that to happen with .aspx files, you want those to be executed and the result spat out to the client. It's not too different to a .txt file opening in notepad but a .xls being opened in Excel. I think the question you may be asking now though is how do you get a request to a .vato file actually become a request to a .aspx file. There are a number of options to do this. Look up URL rewriting, 404 redirects, etc.
Robin Day
No, sorry - as per my original question - I basically want my .aspx pages to "look" different that is all. No such ".vato" files actually exist. I just want my URLs to look different. Is this possible?
Yes, absolutely, this is URL Rewriting. I think I misunderstood your question. I can't answer that one in this comment here (plus it's getting late). If you look around URL Rewriting, within .net and IIS you may find a solution, alternatively, ask another question directly related to this. After all, the entire MVC framework is almost entirely built around the URL rewriting concept.
Robin Day
Thanks - greatly appreciate it!