i am using URL rewriting in my asp.net application using regx
virtual URL is
/ProductDatabaseCMS/(?<category>\w*)/Product/(?<product>\w*)\.aspx
original URL is
/ProductDatabaseCMS/Product.aspx?PROD_ID=${product}
application path is ~/ProductDatabaseCMS
my application has master page that uses style sheet and the path is
~/App_Themes/Styles/Style_Sheet.css
i am requesting the URL
/ProductDatabaseCMS/(?<category>\w*)/Product/(?<product>\w*)\.aspx
from one of the webpage of application using Hyperlink control but in that case stylesheet is not working for this page Because it is taking path
~/ProductDatabaseCMS/(?<category>\w*)/Product/App_Themes/Styles/Style_Sheet.css
what i have to do in this case.
If you use a relative URI to reference the external stylesheet, you have to consider this: Relative URIs are always resolved from a base URI which is the URI of the current resource if not declared otherwise.
So if you request /foo/bar
and there is a relative URI reference css/baz.css
in the HTML document, it would be resolved to /foo/css/baz.css
as /foo/bar
is the base URI.
To solve this problem you have two options:
/App_Themes/Styles/Style_Sheet.css
), or BASE
HTML element (eg <base href="/">
) so that every relative URI is resolved from that new base URI. Use a "root-relative path" for the CSS href. You start the href with "/", that's all.
Try: /App_Themes/Styles/Style_Sheet.css
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.