首先設定 IIS  讓所有檔案都由asp.net 執行

如何將網址的副檔名(.aspx)隱藏?

按右鍵選內容

 

如何將網址的副檔名(.aspx)隱藏?

按設定

 

如何將網址的副檔名(.aspx)隱藏?

按新增

 

如何將網址的副檔名(.aspx)隱藏?

打上 C:\WINNT\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll 和 *

 

 

在 Global.asax.cs 這個檔寫段程式

1 protected void Application_BeginRequest(Object sender, EventArgs e)  
2 {  
3    string url = System.Web.HttpContext.Current.Request.Path;  
4    string query = System.Web.HttpContext.Current.Request.QueryString.ToString();  
5    if (url.IndexOf(".aspx") == -1)  
6       System.Web.HttpContext.Current.RewritePath(url+".aspx"+ (query.Length > 0?"?"+query:""));  
7 }  

相关文章:

  • 2021-08-05
  • 2022-02-07
  • 2022-03-01
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
  • 2021-05-23
  • 2022-12-23
猜你喜欢
  • 2021-08-04
  • 2022-02-16
  • 2021-09-19
  • 2021-07-28
  • 2021-10-15
  • 2022-12-23
  • 2021-07-22
相关资源
相似解决方案