asp.net pseudo static configuration memo

Source: Internet
Author: User
Tags add copy eval iis net return
In short, feel the URL of the site has parameters is a very awkward thing, on the one hand is very easy to inject, on the other hand, parameter transmission is very easy to divulge some useful information.

And this article is mainly aimed at the Web site URL display pseudo static, so abandoned the direct generation of static page of the trouble, and can be very good protection of user privacy, while the site security will also have a certain performance improvement.

The main operating procedures are as follows:

First of all, we need a Microsoft Urlrewriter component, here's the download address I'll provide under:

Http://download.microsoft.com/download/0/4/6/0463611e-a3f9-490d-a08c-877a83b797cf/MSDNURLRewriting.msi

Then you create a new Web site and add the DLL file to your project by adding a reference.

I built the site page is a simple front-office press release system, the page is as follows:

And then there's the list page:

Then the above is titled "3333333" Detailed information display page, the specific display page is:

So for such a page, we have to do pseudo static, first of all, we need to configure Webconfig

As shown in the following illustration:

To be aware of is the <LookFor></LookFor> and <SendTO></SendTO> node, the URL path written to the LookFor node is the externally advertised URL path. The URL path in the SendTo node is the true path that IIS returns when parsing. Part of a node in the above figure is just like the letter D, followed by the numbers. Newslistaspx with parameter return resolution , and the two parts of the node are as long as the letter DD followed by the newsdetails.aspx with the number of return processing, and node three is the HTML request page into ASPX request return.

You also need to add the following modules below the <HttpHandlers> node:

These settings are good, but our IIS default is not able to directly parse the HTML suffix (if not added), then you need to configure IIS, the configuration path is as follows:

Open iis-"Right click on Site-" properties-"switch to the Home Directory tab-" Click "Configure" button-"switch to" map "tab-" double click ". aspx, in the pop-up window, copy the string following executable file--click Add-" Enter a copy of the executable path---à remove "check file exists" checkbox, the last application can be.

After the configuration is complete, on your site, as long as there is similar

<a href= "newslist.aspx?id=<% #Eval (" ID ")%>" ><% #Eval ("Name")%></a>

Modified into

<a href= d<% #Eval ("ID")%>.html "><% #Eval (" Name ")%></a>

and put

<a href= "Newsdetails.aspx? newsid=<% #Eval ("ID")%> "><% #Eval (" Title ")%></a>

Modified into

<a href= "dd<% #Eval (" ID ")%>.html" ><% #Eval ("Title")%></a>

Finally, you can use IIS to access it, Setup is complete



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.