Solved

HttpUtility.UrlDecode # Hash Symbol

Posted on 2011-03-22
3
1,088 Views
Last Modified: 2013-11-29
Hi All,

I use the following code which redirects a user to the URL which is stored within the variable 'strurlredi'..

Response.Redirect("http://" + HttpUtility.UrlDecode(strurlredi));

What I am finding is that if the URL passed within 'strurlredi' includes a # symbol on the end of it then my redirect doesn't function.

Does anyone have any ideas how I can overcome this?

Thanks,

Rit
0
Comment
Question by:rito1
3 Comments
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 250 total points
Comment Utility
Are you sure strurlredi is UrlEncoded in the first place?  A hash symbol should encode as %23 in a URL, and if the Decoded result is "http://site.com/page.htm#" then that's a perfectly valid URL, but if the receiving server doesn't care for the hash then I'd say to put in strurlredi in the first place (although it would normally be ignored, I believe).
0
 
LVL 23

Assisted Solution

by:Tiggerito
Tiggerito earned 250 total points
Comment Utility
Could you explain what "doesn't function" means. Throws an exception? does nothing? Goes to the wrong place?

Is the hash for use  to move to an anchor or an accidental character within the URL?

What version of .Net are you using?

The use of UrlDecode does not seem right to me. What is the content of strurlredi
0
 
LVL 1

Author Closing Comment

by:rito1
Comment Utility
Hi Both,

I have sorted this by removing the # from the end of the URL. If I had more time on it then I would try figuring out why its giving me grief.

Thanks,

Rit
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now