PDA

View Full Version : URL Mapping


paulsohal
04-16-2008, 07:42 AM
Is it possible to configure IIS so that URLMappings works without a file extention?

Example. I want to map www.{mysite}.com/Fred (http://www.{mysite}.com/Fred) to www.{mysite}.com/User.aspx?id=9999 (http://www.{mysite}.com/User.aspx?id=9999)

Seems like it only works if the url I'm trying to map has an aspx extention.

Any help/guidance would be much appreciated.

Thank,
Paul

vvsharma
04-17-2008, 11:43 AM
In case you want to use other extensions within the URLMappings(will work only for integrated mode[Use DASP Control Panel to switch between classic/integrated mode]) ,you need to do the following:

1>From you MS IIS7 Web Manager ,go to 'Handler Mappings' feature and click the 'Add Managed Handler' .Enter the following details:

Request Path = *.*

Type=System.Web.UI.PageHandlerFactory

Name= [anything you want]

This will write the following to your web.config:

<system.webServer>
<handlers>
<add name='MAP' path='*.*' verb='*' type='System.Web.UI.PageHandlerFactory' resourceType='Unspecified' preCondition='integratedMode'/>
</handlers>
</system.webServer>

2>You can add URLMappings to your web.config as follows :

<system.web>
<urlMappings enabled='true'>
<add url='~/index.jsp' mappedUrl='~/default.aspx'/>
<add url='~/index.msft' mappedUrl='~/default.aspx'/>
<add url='~/check.aspx' mappedUrl='~/default.aspx'/>
</urlMappings>
</system.web>

and all the above should work as expected.

I don't think you can map folders to pages though.

Vikram

DiscountASP.NET
www.DiscountASP.NET (http://www.discountasp.net/)

GeekO
05-19-2008, 04:58 AM
I had the same thing working locally by adding some code to the beginrequest method of my global file. But now it does not work and i believe it is because the IIS server is redirecting the URL to a 404 page before reading my global file or using my own coded redirects in the config file. Does this make sense to anyone? Any idea how i can get this working correctly on the server as it was on localhost?