By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,972 Members | 1,383 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,972 IT Pros & Developers. It's quick & easy.

Problems with Theme and Context.RewritePath()

P: n/a
Hi,
I'm using Context.RewritePath() in a HttpModule to get url rewriting done.
http://localhost/Web1/articles ->
http://localhost/Web1/Default.aspx?m=articles

But I'm having problems with Themes when I'm using that.
The problem rises when my url ends with a '/'.

Example:
http://localhost/Web1/articles
works fine

but
http://localhost/Web1/articles/
doesn't.

My path's to my theme resources are messed up, being appended to the
url, like this:
http://localhost/Web1/articles/App_T...v/Articles.css

Has anyone else had this problem (and hopefully fixed it :)

Btw, I rewrite the path back to the original one in Page.OnPreInit() to
get my postbacks go to the rewritten url...

Best regards,
Mats Lycken
Aug 24 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
I had this exact problem. I fixed it by detecting the trialing '/' and
redirecting to the same URL without the '/'. Not very elegant but it worked,

Kevin Jones

Ma***@newsgroups.nospam wrote:
Hi,
I'm using Context.RewritePath() in a HttpModule to get url rewriting done.
http://localhost/Web1/articles ->
http://localhost/Web1/Default.aspx?m=articles

But I'm having problems with Themes when I'm using that.
The problem rises when my url ends with a '/'.

Example:
http://localhost/Web1/articles
works fine

but
http://localhost/Web1/articles/
doesn't.

My path's to my theme resources are messed up, being appended to the
url, like this:
http://localhost/Web1/articles/App_T...v/Articles.css

Has anyone else had this problem (and hopefully fixed it :)

Btw, I rewrite the path back to the original one in Page.OnPreInit() to
get my postbacks go to the rewritten url...

Best regards,
Mats Lycken
Aug 24 '06 #2

P: n/a
Thanks Kevin,
I feared that would have to be my solution :\

//Mats

Kevin Jones wrote:
I had this exact problem. I fixed it by detecting the trialing '/' and
redirecting to the same URL without the '/'. Not very elegant but it
worked,

Kevin Jones

Ma***@newsgroups.nospam wrote:
>Hi,
I'm using Context.RewritePath() in a HttpModule to get url rewriting
done.
http://localhost/Web1/articles ->
http://localhost/Web1/Default.aspx?m=articles

But I'm having problems with Themes when I'm using that.
The problem rises when my url ends with a '/'.

Example:
http://localhost/Web1/articles
works fine

but
http://localhost/Web1/articles/
doesn't.

My path's to my theme resources are messed up, being appended to the
url, like this:
http://localhost/Web1/articles/App_T...v/Articles.css
Has anyone else had this problem (and hopefully fixed it :)

Btw, I rewrite the path back to the original one in Page.OnPreInit()
to get my postbacks go to the rewritten url...

Best regards,
Mats Lycken
Aug 25 '06 #3

P: n/a
Hello Mats,

Does Kevin's sugegstion helpful for your case?

As for the Rewriting, are you only using a HttpModule to perform the
urlrewriting? Based on my understanding, ASP.NET runtime will only receive
request which is targeting the ASP.NET specific document extensions (like
.aspx, .ascx..... ). And for the below style request path, IIS won't
forward it to ASP.NET runtime, have you also used other rewrite components
or are you only testing in VS 2005 test webserver?

http://localhost/Web1/articles
http://localhost/Web1/articles/

In addition, here is a web article which has mentioned a theme's path
rebasing issue when using URL Rewriting, it indicate that we can use the
HttpContext.RewritePath's override version to choose not rebase the url:

http://davidhayden.com/blog/dave/arc...1/14/2693.aspx

Anyway, please feel free to let me know if there is anything I missed or if
you have any particular concerns in your scenario.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 25 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.