url mapping works differently in Cassini than in IIS??

L

Les Caudle

I've gotten url mapping to work perfectly while running in VS 2005 Cassini debug
mode.

I simply added this to web.config

<urlMappings enabled="true">
<add
url="~/school"
mappedUrl="~/Schools.aspx" />
</urlMappings>

and all calls to domain.com/school will map to domain.com/Schools.aspx

However, when I run this in IIS on an XP development box, or on IIS on a Windows
2003 Server box, I get page cannot be found.

I even tried creating a Global.aspx and adding

protected void Application_BeginRequest(object sender, EventArgs e) {
string strCurrentPath = Request.Path;
strCurrentPath = strCurrentPath.ToLower();
if (strCurrentPath.EndsWith(@"/school")) {
string strCustomPath = @"/Schools.aspx";
Context.RewritePath(strCustomPath);
}
}

which worked perfectly in Cassini - but not in IIS on XP or 2003.

I'm perplexed. How can I get this to work?
 
E

Eric

Les said:
I even tried creating a Global.aspx and adding

protected void Application_BeginRequest(object sender, EventArgs e) {
string strCurrentPath = Request.Path;
strCurrentPath = strCurrentPath.ToLower();
if (strCurrentPath.EndsWith(@"/school")) {
string strCustomPath = @"/Schools.aspx";
Context.RewritePath(strCustomPath);
}
}

Is the web.config and Global.aspx in the root directory of the site?

Both the web.config and this code look good to me.

You can insert a System.Diagnostics.Trace.WriteLine to see if this is
executing. You can use the sysinternals DbgView utility to see this
when running from IIS.
 
L

Les Caudle

Yes, both web.config and global.aspx are in the root directory.

Apparently, Cassini works very differently from IIS.

With Casinni, having the code in either web.config or global.aspx works
perfectly. Cassini global.aspx Application_BeginRequest also gets called
repeatedly for images, css, etc. of the web page displayed.

This does not happen in IIS. Application_BeginRequest is only called once for
each page, and it never calls Application_BeginRequest for
domainName.com/school.

So, my best guess is that neither global.aspx nor web.config is even getting a
crack at domainName.com/school. IIS may be eating it - which kind of conflicts
with the documents for urlMappings as I read them.

<urlMappings enabled="true">
<add
url="~/school"
mappedUrl="~/Schools.aspx" />
</urlMappings>

Thanks, Les Caudle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top