IIS rewrite rule change my current aspx page hyperlink href

Nov 24 2017 8:54 AM

when browse my site from local iis then address looks in browser address bar as http://localhost:8800/gb/default.aspx

i tried to extract country code from browser address bar and injected in all hyperlink's href with IIS rewrite outbound rule.

this is my outbound rule i used in my web.config file.

<outboundRules> <rule name="add outbound rule" preCondition="Ishtml" enabled="true" stopProcessing="true"> <match filterByTags="A" pattern="(\/[a-z]+\/)(.*)" negate="true" /> <action type="Rewrite" value="{R:1}{R:2}" /> </rule> <preConditions> <preCondition name="Ishtml"> <add input="{RESPONSE_CONTENT_TYPE}" pattern="text/html" /> </preCondition> </preConditions> </outboundRules>
 
when i pattern test from iis rewrite module window then output looks like below one. here is screen shot.
 

enter image description here

so during test i saw {R:1} is /gb/ and {R:2} is default.aspx. so when this rule execute it change all hyperlink href in default.aspx page and all hyperlink href becomes now http://localhost:8800/gb/default.aspx

basically i need to inject country code from browser address bar url in all hyperlink href of current page.

i think i am bit closer to what i am trying to achieve but now i need little help to sort this issue. i guess this area need to be change bit

so please some help and drive me to right direction.