views:

452

answers:

2

i noticed that when using the URL re-writter out of iis 7.0 that the root url character "~" works correctly but when I re-write the url with the global.asax file, the files no longer map correctly.

Why is this and what can I do to have all the files map properly when using global.asax to re-write urls?

If URL.Contains("/myurl/") Then
Context.RewritePath("~\myurl.aspx")
end if
A: 

When you Re-Write your URL, your style sheet path no longer correct.... Plz check this path... try to use ~ sign in path..

<link href="App_Themes/Standard/StyleSheet.css" rel="stylesheet" type="text/css" />
Muhammad Akhtar
I am using ~ in the path and it doesn't render correctly.
Middletone
I think you have to implement URL Re-writing, check this URL... http://www.urlrewriting.net/149/en/home.html and also check this thread...http://stackoverflow.com/questions/999481/passing-querystring-ids-url-routing-using-namespace-system-web-routing/1000520#1000520
Muhammad Akhtar
A: 

Your problem is probably that the resulting page url no longer refers to a valid location.

If the user is going to http://www.yoursite.com/myurl/home.aspx and that page has a reference to a stylesheet at css/stylesheet.css, it will be wrong when the path is rewritten.

In this case, the browser will be looking for http://www.yoursite.com/myurl/css/stylesheet.css, not http://www.yoursite.com/css/stylesheet.css

If your stylesheet reference is relative, you'll need to put a stylesheet reference that refers to the location of the file from the original URL. Otherwise, you could put in a complete path to avoid any problems.

Damovisa