Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 25, 2012 08:47 AM by Dino He - MSFT
May 18, 2012 06:51 PM|LINK
I am pretty new to URL Rewriting concept. In my project I need to display the url
say for eg. localhost/default.aspx as localhost/en/default.
Also, if the url is like localhost/en/default.aspx, it should redirect as localhost/en/default.
If the language selected is Chinese, the url will be localhost/zh-CHS/default-zh.aspx .
It should be rewritten as localhost/zh-CHS/default-zh.
Also, if url in chinese is localhost/about-zh.aspx it should be displayed as localhost/zh-CHS/about-zh.
The default language is English.
I am trying to achieve this with UrlRewriter.Net (Intelligencia.UrlRewriter)
Can anyone please tell how to write the rules in the web.config to achieve this?
I am doing this project in .Net 4.0 .
May 21, 2012 11:25 AM|LINK
MSDN is your friends
Also you need some regular expression knowledge:
Hope it helpful.
May 22, 2012 04:19 PM|LINK
Can anyone please help. I don't know how to write rules in web.config to achieve extensionless urls
May 23, 2012 07:46 AM|LINK
Have you readed the link I gave you?
First you need to download the URLRewriter.
Then add code like this in your web.config
<section name="RewriterConfig" type="URLRewriter.Config.RewriterConfigSerializerSectionHandler, URLRewriter"/>
In my code LookFor is a regular expression(That's why I said you need to know the regular expression).
So when I input [domainname]/ShowQueryString_post/2012/05/02/1
It will convert to [domainname]/ShowQueryString_post.aspx?Year=2012&Month=05&Day=02id=1
Hope you read those link first, and then post threads with some specific problem.
May 23, 2012 08:45 AM|LINK
I am trying with urlrewriter.net
For that I added a reference for Intelligencia.UrlRewriter dll in my project.
Then in web.config added these sections.
<section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" />
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" />
<add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" />
I don't know how to write the rules in rewrite section.
May 25, 2012 08:47 AM|LINK
You can refer to this link:http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx
<rewrite url="~/products/(.+).aspx" to="~/products.aspx?category=$1" />
Can you understand this line?
(.+) this is a Regulary expression.
I had post the link before.
This line mean when you get ~/products/[anypagename].aspx it will convert to ~/products.aspx?category=[anypagename]
Here is some tutorial.
I think you just can't understand how does the Regular expression work.
I suggest you download this open source URL write module, and try to understand it first.
This response contains links reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you.Microsoft does not control these sites and
has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.There are inherent dangers in the use of any software
found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.