好湿?好紧?好多水好爽自慰,久久久噜久噜久久综合,成人做爰A片免费看黄冈,机机对机机30分钟无遮挡

主頁 > 知識(shí)庫 > Global.asax的Application_BeginRequest實(shí)現(xiàn)url重寫無后綴的代碼

Global.asax的Application_BeginRequest實(shí)現(xiàn)url重寫無后綴的代碼

熱門標(biāo)簽:十堰正規(guī)電銷機(jī)器人系統(tǒng) 手機(jī)地圖標(biāo)注如何刪除 怎么給超市做地圖標(biāo)注入駐店 外呼系統(tǒng)代理品牌 巫師3為什么地圖標(biāo)注的財(cái)寶沒有 世紀(jì)佳緣地圖標(biāo)注怎么去掉 寧波自動(dòng)外呼系統(tǒng)代理 辦理400電話證件 外呼系統(tǒng)費(fèi)用一年
利用Global.asax的Application_BeginRequest 實(shí)現(xiàn)url 重寫 無后綴
復(fù)制代碼 代碼如下:

%@ Application Language="C#" %>

script RunAt="server">
void Application_BeginRequest(object sender, EventArgs e)
{
string oldUrl = System.Web.HttpContext.Current.Request.RawUrl; //獲取初始url

//~/123.aspx → ~/Index.aspx?id=123
Regex reg = new Regex(@"^\/\d+\.html");
if (reg.IsMatch(oldUrl))
{
string id = reg.Match(oldUrl).ToString().Substring(1, reg.Match(oldUrl).ToString().LastIndexOf(".") - 1);
Context.RewritePath("~/Index.aspx?id=" + id);
}

//~/123 → ~/Index.aspx?id=123
Regex reg1 = new Regex(@"^\/\d+$");
if (reg1.IsMatch(oldUrl))
{
string id = reg1.Match(oldUrl).ToString().Substring(1);
Context.RewritePath("~/Index.aspx?id=" + id);
}

//~/index/123 → ~/Index.aspx?id=123
Regex reg3 = new Regex(@"^\/index\/\d+$");
if (reg3.IsMatch(oldUrl))
{
string id = reg3.Match(oldUrl).ToString().Substring(7);
Context.RewritePath("~/Index.aspx?id=" + id);
}
}

/script>
您可能感興趣的文章:
  • asp.net 在global中攔截404錯(cuò)誤的實(shí)現(xiàn)方法
  • Global.cs中自動(dòng)獲取未處理的異常
  • 在Global.asax文件里實(shí)現(xiàn)通用防SQL注入漏洞程序(適應(yīng)于post/get請(qǐng)求)
  • Global.asax取絕對(duì)路徑的方法
  • Global.asax取物理路徑/取絕對(duì)路徑具體方法
  • Global.asax的Application_Error實(shí)現(xiàn)錯(cuò)誤記錄/錯(cuò)誤日志的代碼
  • c#定時(shí)器和global實(shí)現(xiàn)自動(dòng)job示例
  • ASP.net全局程序文件Global.asax用法分析
  • ASP.NET中Global和URLReWrite用法
  • 在C#中g(shù)lobal關(guān)鍵字的作用及其用法

標(biāo)簽:山西 景德鎮(zhèn) 通遼 牡丹江 嘉興 泰州 天門

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《Global.asax的Application_BeginRequest實(shí)現(xiàn)url重寫無后綴的代碼》,本文關(guān)鍵詞  Global.asax,的,Application,BeginRequest,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《Global.asax的Application_BeginRequest實(shí)現(xiàn)url重寫無后綴的代碼》相關(guān)的同類信息!
  • 本頁收集關(guān)于Global.asax的Application_BeginRequest實(shí)現(xiàn)url重寫無后綴的代碼的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章