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
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