Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

IIS Rewrite rule: Attach country code with all hyperlinks in page

$
0
0
i have developed a web site with asp.net webform. i hosted the site my pc local iis. when i browser the site the url appear in my browser address bar looks like http://localhost:8800/gb/default.aspx

now my default.aspx page has many hyperlinks and those links look likes

http://localhost:53741/
http://localhost:53741/About.aspx
http://localhost:53741/Contact.aspx

now i want to attach country code taken from browser address bar url with all the links in default.aspx page. so after attaching the new url will be looking like

http://localhost:53741/gb
http://localhost:53741/gb/About.aspx
http://localhost:53741/gb/Contact.aspx
so i test a outbound rule to attach country code with all the links in my default.aspx page.

my outbound rule look like....a screen shot attached.

screen shot 1

enter image description here[^]

screen shot 2

enter image description here
[^]

screen shot 3

enter image description here[^]

after implementing my outbound rule when i am browsing my site then getting error due to outbound rule. i am weak in iis rewrite rule. may some where i made mistake but could not figure out my mistake. so please some one help me to fix this issue.

again i am telling what i am trying to do. when i am browsing my site then my address bar url look like http://localhost:8800/gb/default.aspx in this url there is a country code that is gb.

the country code i need to take from there with outbound rule and attach that country code with all the hyperlinks in default.aspx page. so my all hyperlinks in default.aspx page will be looking like below example.

http://localhost:53741/gb
http://localhost:53741/gb/About.aspx
http://localhost:53741/gb/Contact.aspx
this iis rewrite rule i tried

<outboundRules><rulename="add outbound rule"preCondition="Ishtml"enabled="true"stopProcessing="true"><matchfilterByTags="A"pattern="([a-z]{2}/(.*))"negate="true"/><actiontype="Rewrite"value="gb/{R:2}"/></rule><preConditions><preConditionname="Ishtml"><addinput="{RESPONSE_CONTENT_TYPE}"pattern="text/html"/></preCondition></preConditions></outboundRules>


after applying the above rule i am getting error and error as follows

Parser Error Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The content in the application file is not valid.
if still my objective not clear to anyone then please ask me. if anyone understand what i am trying to do then please help me to achieve my goal. thanks

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>