Click here to Skip to main content
15,921,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI

when i am using the Rewrite url ,the aspx css are not called But the rewrite URL is Working why?

Plz give me suggestion


Example :


When I am not Using Rewrite URL


Page designe is good (calling all css of that page)

XML
<u><b></b>
When I am Using Rewrite URL
</u>


Page designe is Not good ( css are not called)

i am using Web.config rewrite url

<rewrite url="~/Cardetails/(.+)-(.+).aspx" to="~/MoreCars.aspx?strId=$2">

In .aspx.CS Page
C#
public static string GenerateURL(object Title, object strId)
   {
       //object CarManufacturer, object CarModel

       //Title means propertytype,strid means location
       string strTitle = Title.ToString();

       #region Generate SEO Friendly URL based on Title
       //Trim Start and End Spaces.
       strTitle = strTitle.Trim();

       //Trim "-" Hyphen
       strTitle = strTitle.Trim('-');

       strTitle = strTitle.ToLower();
       char[] chars = @"$%#@!*?;:~`+=()[]{}|\'<>,/^&"".".ToCharArray();
       strTitle = strTitle.Replace("c#", "C-Sharp");
       strTitle = strTitle.Replace("vb.net", "VB-Net");
       strTitle = strTitle.Replace("asp.net", "Asp-Net");

       //Replace . with - hyphen
       strTitle = strTitle.Replace(".", "-");

       //Replace Special-Characters
       for (int i = 0; i < chars.Length; i++)
       {
           string strChar = chars.GetValue(i).ToString();
           if (strTitle.Contains(strChar))
           {
               strTitle = strTitle.Replace(strChar, string.Empty);
           }
       }

       //Replace all spaces with one "-" hyphen
       strTitle = strTitle.Replace(" ", "-");

       //Replace multiple "-" hyphen with single "-" hyphen.
       strTitle = strTitle.Replace("--", "-");
       strTitle = strTitle.Replace("---", "-");
       strTitle = strTitle.Replace("----", "-");
       strTitle = strTitle.Replace("-----", "-");
       strTitle = strTitle.Replace("----", "-");
       strTitle = strTitle.Replace("---", "-");
       strTitle = strTitle.Replace("--", "-");

       //Run the code again...
       //Trim Start and End Spaces.
       strTitle = strTitle.Trim();

       //Trim "-" Hyphen
       strTitle = strTitle.Trim('-');
       #endregion

       //Append ID at the end of SEO Friendly URL
       strTitle = "Cardetails/" + strTitle + "-" + strId + ".aspx";

       return strTitle;
   }
Posted

Hi,


Please try link given below:

CSS and JavaScript Not Loading After URL Rewriting

url-rewriting-in-asp-net-loses-stylesheet-mappings








Don't forget to mark useful responses as Answer if they helped you towards a solution.
 
Share this answer
 
create url_rewriting by global.asax
then you will get css
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900