I want to know how to make SEF URL for web pages. After a little googling I have found many techniques, but all of them are so complicated. I do not need them. Is there any way to make SEF URL which is very easy to implement?
问题:
回答1:
First download this reference .
Then import it to your web site.
under <configuration>
node type this:
<configSections>
<section name="urlrewritingnet" requirePermission="false" type="UrlRewritingNet.Configuration.UrlRewriteSection, UrlRewritingNet.UrlRewriter"/>
</configSections>
The next step is typing the following code under <system.web>
node:
the next one is putting the following line just before </configuration>
tag:
<urlrewritingnet configSource="RewriteRules.config"/>
We are almost done!
Create a new .config file which matches the tag's configResource parameter. I preferred "RewriteRules.config".
Then it is time to create rewriting rules on RewriteRules.config file:
<urlrewritingnet rewriteOnlyVirtualUrls="true" contextItemsPrefix="QueryString" defaultPage="Default.aspx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07">
<rewrites>
<add name="DetailPageRule" virtualUrl="^~/VirtualDetailPageName/(.*)/(.*).aspx" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="~/RealDetailPage.aspx?param1=$1&param2=$2" ignoreCase=" true"/>
</rewrites>
</urlrewritingnet>
If you have more or less parameters you can change the count of (.)'s. Here there are only two parameters (param1 and param2), so there are only two (.) strings.
Final Step is giving links in according to the rules you have created.
It is simple and fast. But I do not know if there are drawbacks or any security issues.