tags:

views:

34

answers:

3

I'm trying to use Response.Redirect(1019characterLongUrl) to redirect the user to another domain. The URL I use is +1k characters long. This works perfectly in Chrome and Firefox. But as soon as I use Internet Explorer the hostname of the url is exchanged.

If the URL I use looks something like: https://a01-bc-def.com/myDirA/myDirB?myQuery=XYZ... (note that https changes to http) it would then be malformed in the redirect to http://localhost:9200/bc-def/myDirA/myDirB?myQuery=XYZ... or to http://localhost:9200/myDirA/myDirB?myQuery=XYZ... (why it changes between the two mentioned formats, I don't know - but I believe it has something to do with the length of the url I use).

According to several sites found via Google, the maximum allowed length of an URL in IE is 2083 characters. Meaning that my URL should be okay to use. Could it be related to the fact that the URL uses SSL? I've tried sending redirects from HTTP -> HTTPS as well as HTTPS -> HTTPS without any success. If I manually enter the URL it works without any errors.

I've tried using a tinyURL in the redirect but the same error occurs. I've also tried publishing the site to a public server (with and without SSL as mentioned about) but the error remains.

Any thoughts?


EDIT: I've managed to work around this by using the Refresh meta tag! This feels like a very ugly solution so I still wish to solve the main problem.

A: 

I looked the at underlying code for Redirect and it is realy messy. I am interested to find out the issue and I will try reproducing it when Iget home.

Aliostad
A: 

Check this link out. Have you looked at Server.Transfer.

Here are some additional checking

  • HTTPS uses port 443. Is that open on the server/firewall?
  • Is the SSL certificate setup correctly?
Saif Khan
Yes - Server.Transfer can not redirect you to another website (according to the specs). Don't know, will check - I believe so! Yes, it is (as far as I've been told).
Zolomon
Here is a related post http://stackoverflow.com/questions/2701223/asp-net-response-redirect-max-url-length
Saif Khan
Here is something elase to read http://www.codeproject.com/KB/aspnet/aspnet_ssl_redirects.aspx
Saif Khan
can you see if it throws an exception? http://www.c6software.com/articles/ThreadAbortException.aspx
Saif Khan
A: 

Can you show us the relevant code where you call Response.Redirect?

Server.Transfer basically transfers your call from one page on your server to a separate page (must be on your sever) without telling your browser to redirect to a new URL. Response.Redirect sends a message to the browser to call the new URL you specify so it will allow you to transfer to external pages.

bechbd
I did in the first line of my question - the 1019characterLongUrl variable is just a string variable that contains an URL that's around 1019 characters long. Yes I know - that's why I'm not using it!
Zolomon
I meant some more of the code surrounding that statement. How is the 1019characterLongUrl constructed?
bechbd
Dim 1019characterLongUrl as String = "veryLongURL..." - where veryLongURL resembles the format as shown above.
Zolomon