URL rewriting can make the website look more organized, and make the old connections after the website revision continue to be used.
Refer to the URL recommendations provided by availability expert Jakob Neilsen.
Msdn reference:
English: http://www.microsoft.com/china/msdn/library/webservices/asp.net/URLRewriting.mspx
English: http://msdn.microsoft.com/library/default.asp? Url =/library/en-US/dnaspp/html/urlrewriting. asp
For simplicity, why does each URL end up with aspx? If it is not aspx, it cannot be mapped to ASPnet for processing. To map the/2004/directory to ASPnet for processing, you need a filter in IIS.
I used the filter http://www.qwerksoft.com/products/iisrewrite/download.asp. I have tried several types of products, and they are almost easy to use in iis5.0. When I got to iis6.0, there was a problem. If the directory/2004/exists, it is easy to use. If the directory does not exist, the Error 404 is returned directly. Only this filter can be used before iis6.0 determines that a directory exists.
The content of my configuration file is:
Rewriteengine on
Rewriterule ([^ \ n] *)/$1/default. aspx
In this way, the problem arises, which is equivalent to blocking the setting of the hosts page in IIS. The hosts page can only be default. aspx.
Further, what if I use the/2004 name for access? Because the filter only overwrites the last URL of/, other values cannot be judged. My solution is to write a 404. aspx
Private Sub page_load () Sub Page_load ( Byval Sender As Object , Byval E As System. eventargs) Handles Mybase . Load
Dim Stemp As String = Server. urldecode (request. querystring. tostring ())
If (Stemp. Chars (stemp. Length - 1 ) = " / " C) Then
Server. Transfer ( " / " )
Else
Stemp = Stemp. substring (stemp. indexof ( " ; " ) + 1 )
Response. Redirect (stemp & " / " )
End If
End sub
Then, in the IIS property-> custom error message, change the default value of 404 to Message Type: URL, and URL to/404. aspx.
Although the efficiency is relatively low and the redirection is required once, it is better than not being able to access the service because the user has played one/fewer.
You are welcome to add, criticize, and correct your suggestion.