views:

358

answers:

2

hi all, i have implemented Intelligencia.UrlRewriter im my masterpage site.

I am successfully able to redirect the page.

but on the virtual path its not able to find the CSS/javascript file.

Also its not able to find when i user url like http://localhost/mywebsite/test/ but it works when i use http://localhost/mywebsite/test

my rule is as following

<rewrite url="^.*-c([0-9]+).html/?$" to="~/ProductsByCategory.aspx?cid=$1" processing="stop" />
 <rewrite url="^.*-p([0-9]+)/?$" to="~/ProductDetails.aspx?pid=$1" processing="stop" />
+1  A: 

your path should be look like, use ~ sign to map server path

<link href="~/App_Themes/StyleSheet.css" rel="stylesheet" type="text/css" />

Edit: In web.config where you putting URL-rewrite rule, put rule for js and css files like

<add name="indexJS" virtualUrl="^~/(.*)/(.*)/(.*).js"    rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/js/$3.js" ignoreCase="true" />

Note: Rule is not exactly, I have implement different dll, you can change your accordingly

Muhammad Akhtar
Thanks Muhammad.but please can you explain little bit more? where to add the js rule?
Pragnesh Patel
In your web.config, where you have already define other rules, put these as well for js and css files
Muhammad Akhtar
A: 

I found it working after using resolveurl as following. I found solution at http://dotnetguts.blogspot.com/2008/06/master-page-image-display-problem-and.html

Thanks

<img src="<%= Page.ResolveUrl("~")%>Images/Logo.gif"/>
Pragnesh Patel