ASP.NET replaces parameters with virtual paths

zhaozj2021-02-16  190

ASP.NET replaces parameters with virtual paths. This technique is actually not needed, and QueryString effect is exactly the same. Then what is we cost it? One sentence, for Google.

Paying attention to friends about Google Articles know that the web page of static address is always preferred in Google to take QueryString parameters. In principle, Google feels that the same page is often changed, and the effectiveness of the results of the query is relatively poor, and it may change it later. Generally, the order in the general meaning:

http://www.msn.com/index.htm> http://www.msn.com/index.aspx> http://www.msn.com/index.aspx?id=1

So there is a virtual path to replace parameters, so that yourself ranked in Google in advance. See what we are using. TEXT is also doing it. My blog address is: http://blog.9cbs.net/dawave/archive/2004/08/07/68322.aspx, take a closer look, everyone discover 2004/08/07/68322 is actually parameters . 20004/08/07 is the date, 68322 is the ID number of the article. Everyone can read. Source code research of TEXT. If you feel that that is too complicated, look at my example below.

Because the content is more, the last time (Eclipse, Lomboz & Tomcat) is divided into several times.

Environment .NET plus IIS basic development concept you have to have, for example, build an application in IIS, know where to find a web.config file, compile your C # file and put it in the correct position, edit the ASPX file. I have brought it, I hope you already know how to deal with it, otherwise, please refer to the introductory tutorial about ASP.NET.

Why don't we talk about .net? Because it is not free free software, you can't guarantee that everyone can get it. If he is based on him, those friends who have no money to use vs .NET will be fog. First we speak Handler, ASP.NET with Handler to process some tasks similar to Filter, or Listener, and a simplest handler program is like this:

Namespace test {public class testHandler: httphandler {public void processRequest (httpContext context) {context.server.transfer ("./ index.aspx? from = myhandler");}

Public Bool Isreusable {Get {Return True;}}}}

At least two functions are required: ProcessRequest, Isreusable. The above Handler turned all of the Request to the previous directory of Index.aspx. Compile this handler and put it in a bin directory. Everyone remembers to put an index.aspx first, otherwise the file can be displayed when it is tested, and I thought it was a Handler error.

About web pages, there is something to pay attention to: There are actually two stevers, Transfer and Redirect, Transfer happen to the server side, and Redirect occurs in the Client side. That's why TRANSFER turns, your IE address bar does not change, while the redirect turns, the new address is displayed in the address bar. We ask our webpage no parameters, you must use Transfer, not to use Redirect, from technology, TRANSFER is more faster than Redirect. The next thing is to modify web.config, in the system.Web segment, add the following:

It tells IIS to touch all ASPX files in the TEST directory, processed by our TestHandler.

Test: Open IE, type localhost / test / abc.aspx, you should go to the index file in your application directory.

In Index, you can test, simply add a <% Request ["from"]%>, let the Parameters passing over the Handler on the screen.

Then this article published the article on the ASP.NET HANDLER series, please indicate some original, transfusion or reference, please indicate.

Next introduction to handle processing parameters in HANDLER

转载请注明原文地址:https://www.9cbs.com/read-8110.html

New Post(0)