Response.Redirect(); doesn't work on SOME servers

M

mark mcfarlane

I have a simple button on a page with a
Response.Redirect("http://www.microsoft.com"); in the call back. There's
lotsof other stuff going on on the page, but not in this buttonPress method.
There's only on eline of code in the buttonpress method,
Response.Redirect(http://www.microsoft.com);

The code works perfectly on several Windows XP machines. The redirect does
not work on 2 different Windows 2003 servers.

I have tried numerous 'fixes' recommended by people (flushing and closing
the response object, using the true/false version, putting it in a try
block, removing it from a try block,....) Nothing makes a difference,

Server.Transfer("url"); gets around the problem, but I don't like it because
the URL is now wrong in the browser window. Also, like most programmers, a
'fix' just isn't enough, I have to understand WHY this isn't working
correctly or I can't sleep, my hair will fall out, ....

Anyone else have an idea?

This must be a configuration setting for IIS, or a bug in IIS 6.0 and the
ASP.NET version on my deployment web server.

Mark McFarlane
 
B

bchandley

Mark,
Is this the only functionality that is lost? Have you confirmed that
the code is being hit, via Tracing or a Response.Write

I ask because I have had problems with related to form validation bug,
where page validation never allows a form to postback, because the JS
validation ASP.NET uses is always blocks the submit event.

This is only relavent if you are using the validator Controls on your
webform.

I mention it because it was a 2003 box where I first saw this problem.

If this does apply, here is more info on the bug:

http://scottonwriting.net/sowBlog/posts/2943.aspx
 
M

mark mcfarlane

Is this the only functionality that is lost? Have you confirmed that
the code is being hit, via Tracing or a Response.Write

I ask because I have had problems with related to form validation bug,
where page validation never allows a form to postback, because the JS
validation ASP.NET uses is always blocks the submit event.

This is only relavent if you are using the validator Controls on your
webform.
I mention it because it was a 2003 box where I first saw this problem.

If this does apply, here is more info on the bug:

http://scottonwriting.net/sowBlog/posts/2943.aspx

The code in the line before the response.redirect is being executed (a
database save). Yes I am using validators. I tried the fix from your blog
but as I expected that didn't work either becuase my call back was occurring
and the blog fix seems to be intended to fix cases where the callback isn't
happenning.

I've had a few other really weird things happen on this Windows 2003 server
(actually, it is a Windows 2003 server hosting other virtual servers).

I'm off for a weeks vacation and then I'm going to try installing the Win
2003 SP 1 and reinstalling the .NET Framework when I return.
 
Joined
Jul 29, 2006
Messages
1
Reaction score
0
MY PROBLEM WAS RESOLVED BY THIS POST

I was having the same problem, and my code was very simple. Here is my code that didn't work and now does:
<code>
Private Sub LinkButtonExportToExcel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles LinkButtonExportToExcel.Click
Response.Redirect(ExportAndDownload.DataGrid(Me._grid))
End Sub
</code>

After reading through this post, I realized that I was using an Anthem version of the Link Button which inserts java code through the control. When I converted the Link Button to a standard ASP control the code worked with no problem.

Though this may not be the same problem, the import thing to learn here is that it may not be your code behind, but the code on the front form and most importantly the java that, the controls you use, loads. I've noticed simular issues, not just with Ajax and Anthem but with using controls that insert java in to pages that already have inserted java.

Hopes this helps someone!

Thanks,
Jason Martin
Ensonix Enterprises, Incorporated
http://www.ensonix.com
 
Last edited:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top