Rank: Member
Joined: 12/19/2006(UTC) Posts: 20
|
I love this feature... But a question, how flexible is it? In playing with the demo, I was able to define a custom path to a .aspx page, but is it possible to do have a url without an extension? In transitioning my current site to this, I'm looking for a way to use my existing url structure which does not have an extension. This did not seem to work in the demo environment. So, what I'm looking for is something like www.mysite.com/category/product (instead of www.mysite.com/category/product.aspx). If this is not supported out of box, does anyone have any creative suggestions on how this might be accomplished? I'm thinking of setting it to www.mysite.com/category/product/default.aspx and just making sure default.aspx is defined as the default page in IIS, and create the links without the default (somehow). I'm taking a good serious look at the demo again, so I'm sure I'll have more questions as I come across them, thanks!
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 2,136
Was thanked: 1 time(s) in 1 post(s)
|
Internet Information Server (the web server software) uses the file extension to figure out which IIS extension is responsible for the request. For example if the URL ends with *.aspx then IIS will send the request to ASP.NET. Requests that have no file extension are handled by IIS internally. That is why requests for http://mysite.com/category/product are not handled by the URL rewriting feature in BVC5...the request is never even sent to ASP.NET. If you have access to the server (or some sophisticated control panel) then you can configure IIS to forward all requests to ASP.NET. If you do that, then BVC5 will see the request for http://mysite.com/category/product and you can rewrite it to a custom page. |
|
|
|
|
Rank: Member
Joined: 11/20/2005(UTC) Posts: 122
|
A tip: If you use a page called Default.aspx in the directory, the request will be forwarded to ASP.NET automatically. You simply ensure every virtual directory that is specified in your fictitious URL structure physically exists on your site, and add a blank Default.aspx page to the each directory. A good resource for URL Rewriting can be found here: http://msdn2.microsoft.c...us/library/ms972974.aspx |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 1,786
|
The URLs need the .aspx extension unless you configure IIS to process all requests through asp.net. The downside to using asp.net to process all requests is that requests for static text, images, etc. will be slower than just letting IIS handle them.
|
|
|
|
Rank: Member
Joined: 11/20/2005(UTC) Posts: 122
|
Marcus, I wasn't referring to using ASP.NET to handle all requests. Let me give you an example. Say you want to use the visible URL to in the browser to be: http://www.mysite.com/Products/Accessories/ThingWhen this request comes in, by default IIS will try to find a default.aspx page that exists in a virtual directory named /Products/Accessories/Thing. If you physically create the virtual directory on the server and put a default.aspx page in the directory, the request will be forwarded to ASP.NET by IIS and the URL rewriting will work even though you didn't use a .aspx extension in your fictitious URL. |
|
|
|
|
Rank: Member
Joined: 11/5/2003(UTC) Posts: 1,786
|
Yes, you are correct that will work but only if you physically create that folder and the default.aspx file on your server. It will not work if you just use it in a URL without actually creating the file.
|
|
|
|
Rank: Member
Joined: 4/4/2004(UTC) Posts: 670
|
We use ISAPI_Rewrite to get around a lot of these issues. IIS7 supports extensionless URL Rewriting. Scott Mech [email protected]
|
|
|
|
Rank: Member
Joined: 5/17/2004(UTC) Posts: 456
|
Sorry if stupid question here....why would you NOT want an extension to display on the web? What benefit is this? Or what does it help you solve or do?
|
|
|
|
Rank: Member
Joined: 4/4/2004(UTC) Posts: 670
|
BigHeadRob, There are plenty of reasons why you would do this. Take a look at myspace. The site runs a lot of asp.net, but you will find Coldfusion .cfm extensions on some of the same URLS.
Scott Mech
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.