HttpContext.RewritePath Broken in 2.0 Final Relase

C

cpnet

I was playing around with Beta 2 of VS2005, .NET 2.0, and built an
IHttpModule do allow me to have nice URL's in my web app. It was working
great. I had a URL like:

http://mydomain.com/Users/BobSmith/
or
http://mydomain.com/Users/BobSmith

The "BobSmith" didn't actually exist. My HttpModule would use RewritePath
method to return a page from:

http://mydomain.com/Users/Default.aspx?userid=BobSmith

Default.aspx was built from a MasterPage, and the MasterPage referenced
style sheets and some images. These links were written using the "~"
character (i.e. "~/pics/something.gif"). I found that if I had to use:

httpContext.RewritePath(
"http://mydomain.com/Users/Default.aspx?userid=BobSmith", false);

when calling RewritePath, otherwise the links to my gif's and stylesheets
rendered by http://mydomain.com/Users/Default.aspx?userid=BobSmith would be
wrong and thus they wouldn't show up.

Now I have installed (on a fresh Virtual PC) the final release 180-day trial
of the Team System Suite. I broght my code over, and RewritePath no longer
works. Using
httpContext.RewritePath(
"http://mydomain.com/Users/Default.aspx?userid=BobSmith", false);
seems to now work the same as
httpContext.RewritePath(
"http://mydomain.com/Users/Default.aspx?userid=BobSmith", true);
and
httpContext.RewritePath(
"http://mydomain.com/Users/Default.aspx?userid=BobSmith");

So, depending on the link the use types into the browser (i.e. whether or
not they include the last "/" after "BobSmith") the client browser gets the
wrong path to the images and stylesheets. I see there's a new 4th overload
for RewritePath, but the documentation isn't clear to me. I don't know if
there's a different way to be doing the same thing or not? Is this a bug
introduced between beta 2 and the final release of .NET 2.0? Can someone
tell me what I can do to avoid this problem?

Thanks
cpnet
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top