I can retract a blog post right??
My blog post the other evening was quick to point the finger at the ~/ functionality within the .Net framework. After further review, and questions from Nick[^], I came to realize I was wrong in my statement. Now we know why Nick's[^] an MVP!
The problem actually seems to be coming from using Request.Url to get the Url of the current page. What I was doing looked something like this:
1Helpers.UrlQueryString myQs = new Helpers.UrlQueryString(Request.Url.ToString());
When I started to debug this code, I noticed that Request.Url was coming back with http://12.12.12.12/page.ashx instead of http://12.12.12.12:123/page.ashx. Then when I went to actually use the value my helper was holding, I would do this:
1Response.Redirect(myQs.AbsoluteUri);
To get the desired functionality I was forced to rework how the redirect worked. Now it looks like this:
1Response.Redirect("~/" + Path.GetFileName(Request.PhysicalPath) + myQs.Get()); This is less than elegant, however, it works. Fortunately, the code that was causing this issue was in a single user control that was used throughout the site. So making this change was very simple, and fixed all of the broken links in my site.
I want to do more research into this to see if I am missing something else. If I am not, I plan to modify the UrlQueryString object and create a method that returns me the resolved path including the querystring in one value.
Be the first to rate this post
- Currently 0/5 Stars.
- 1
- 2
- 3
- 4
- 5