当我使用Rewrite url时,不会调用aspx css [英] when i am using the Rewrite url ,the aspx css are not called
问题描述
HI
当我使用重写网址时,aspx css未被调用但重写网址正在工作原因?
Plz给我建议
例如:
当我没有使用重写URL
页面设计很好(调用该页面的所有CSS)
< u > < b > < / b >
当我使用重写URL $时b $ b < / u >
Page designe不好(c ss没有调用)
i我正在使用Web.config重写url
< rewrite url = 〜/ Cardetails /(.+)-(.+).aspxto =〜/ MoreCars.aspx?strId = $ 2>
in .aspx .CS页
public static < span class =code-keyword> string GenerateURL( object Title, object strId)
{
// 对象CarManufacturer,对象CarModel
// 标题表示propertytype,strid表示位置
string strTitle = Title.ToString();
#region根据标题生成SEO友好URL
/ / 修剪开始和结束空格。
strTitle = strTitle.Trim();
// 修剪 - 连字符
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);
// 替换。 with - 连字符
strTitle = strTitle.Replace( 。,< span class =code-string> - );
// 替换特殊字符
for ( int i = 0 ; i < chars.Length; i ++)
{
string strChar = chars.GetValue(i)的ToString();
if (strTitle.Contains(strChar))
{
strTitle = strTitle.Replace(strChar,串跨度> .Empty);
}
}
// 将所有空格替换为 - 连字符
strTitle = strTitle.Replace( , - );
// 用单个 - 连字符替换多个 - 连字符。
strTitle = strTitle.Replace( - , - );
strTitle = strTitle.Replace( ---, - );
strTitle = strTitle.Replace( ----, - );
strTitle = strTitle.Replace( -----, - );
strTitle = strTitle.Replace( ----, - );
strTitle = strTitle.Replace( ---, - );
strTitle = strTitle.Replace( - , - );
// 再次运行代码......
< span class =code-comment> // 修剪开始和结束空格。
strTitle = strTitle.Trim();
// 修剪 - 连字符
strTitle = strTitle .Trim(' - ');
#endregion
// 在SEO友好URL末尾附加ID
strTitle = Cardetails / + strTitle + - + strId + .aspx;
return strTitle;
}
2>
In .aspx.CS页面
public static string GenerateURL( object 标题,对象 strId)
{
// 对象CarManufacturer,对象CarModel
// 标题表示propertytype,strid表示位置
string strTitle = Title.ToString();
#region根据Title $生成SEO友好URL b $ b // 修剪开始和结束空间。
strTitle = strTitle .Trim();
// 修剪 - 连字符
strTitle = strTitle.Trim(' - );
strTitle = strTitle.ToLower();
char [] chars = @ < !?/ BLOCKQUOTE>
%#@ *;:〜`+ =()[] {} | \'<>,/ ^&安培; 跨度>。。 ToCharArray();- );
strTitle = strTitle.Replace( c#, C-Sharp);
strTitle = strTitle.Replace( vb.net, VB-Net);
strTitle = strTitle.Replace( asp.net, Asp-Net);
// 替换。 with - 连字符
strTitle = strTitle.Replace( 。,< span class =code-string>
// 替换特殊字符
for ( int i = 0 ; i < chars.Length; i ++)
{
string strChar = chars.GetValue(i)的ToString();
if (strTitle.Contains(strChar))
{
strTitle = strTitle.Replace(strChar,串跨度> .Empty);
}
}
// 将所有空格替换为 - 连字符
strTitle = strTitle.Replace( , - );
// 用单个 - 连字符替换多个 - 连字符。
strTitle = strTitle.Replace( - , - );
strTitle = strTitle.Replace( ---, - );
strTitle = strTitle.Replace( ----, - );
strTitle = strTitle.Replace( -----, - );
strTitle = strTitle.Replace( ----, - );
strTitle = strTitle.Replace( ---, - );
strTitle = strTitle.Replace( - , - );
// 再次运行代码......
< span class =code-comment> // 修剪开始和结束空格。
strTitle = strTitle.Trim();
// 修剪 - 连字符
strTitle = strTitle .Trim(' - ');
#endregion
// 在SEO友好URL末尾附加ID
strTitle = Cardetails / + strTitle + - + strId + .aspx;
return strTitle;
}
您好,
请尝试下面给出的链接:
在URL重写后不加载CSS和JavaScript
url-rewriting-in-asp-net-loses-stylesheet-mappings
如果他们帮助您找到解决方案,请不要忘记将有用的回复标记为答案。
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)
<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
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;
}
2">
In .aspx.CS Page
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; }
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.
这篇关于当我使用Rewrite url时,不会调用aspx css的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!