Click here to Skip to main content
15,885,182 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I had used the IIS 7 to rewrite URL, my URL rewriting has be accomplished successfully . I want that rewritten url to be displayed on every button click but the original url is only displayed. Please let me know how to display the rewritten URL only...
Posted
Comments
Afzaal Ahmad Zeeshan 15-Nov-14 7:53am    
Have a used Request.Url, it will show the current URL.
Kornfeld Eliyahu Peter 16-Nov-14 3:39am    
How did you do the URL rewrite?
Irene Joyce 17-Nov-14 5:20am    
using rewrite module in IIS

See this article about how to define rules using UI - http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module[^]
In the section 'DEFINING AN ACTION' choose 'Redirect' instead of the default 'Rewrite'...
 
Share this answer
 
Comments
Irene Joyce 17-Nov-14 5:31am    
Thanks Peter, I have tried this, but there seems to be no difference...
Response.Redirect(URL) should work for you.
 
Share this answer
 
Comments
Irene Joyce 17-Nov-14 6:11am    
thanks Shweta, I need to display the alias url on my button click...
Irene Joyce 17-Nov-14 6:22am    
thanks, I am looking into this solution...will get back to you soon.
Irene Joyce 17-Nov-14 6:32am    
This solution is fine when we have few pages. what can be done in case of dynamic query string in the url???
Shweta N Mishra 17-Nov-14 6:37am    
Yes, You can do that, instead of hardcoded strings pass the dynamic URL field as string .
Can you share the ARR rule that you have created. I hope the pattern is not matching that is the reason you are not getting redirected to new URL.

- Maheswaran.S
 
Share this answer
 
can you detail your issue more. As per my understanding you are doing URL Re direction via ARR Rules. You want to consume the target (new) URL on Button Click. Is this after new URL page load or you want to retrieve the target URL before redirection on Button click ?

- Maheswaran.S
 
Share this answer
 
Comments
Irene Joyce 17-Nov-14 5:13am    
Yes, I will explain it to you in detail:

What I wanted to do initailly:
> I wanted to convert Doctors.aspx?Address=Delhi&Category=Cardiologist
as doctors/delhi/cardiologist
What I have done so far:
> I have used IIS rewrite module rules to rewrite the url
> Now when i type doctors/delhi/cardiologist I am directed to the right page(but CSS of the page is not functioning properly)
The following question's solution is what i am looking for
> Consider I have a link cardiologists in delhi, When I click this link the redirected page's url is still dispalying as Doctors.aspx?Address=Delhi&Category=Cardiologist whereas i want it to display as doctors/delhi/cardiologist

I hope my question is clear to you now???

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900