Solved

Response.redirect not working but Server.Transfer does...why?

Posted on 2010-08-18
5
692 Views
Last Modified: 2013-11-08
I have a web site on a WAN. The local users have not trouble navigating through the site, only the remote users are having problems. I narrowed it down to the Response.Redirect syntax
Response.Redirect("~/Budget/BudgetManager.aspx?UserId=" & pdId & "&Practice=" & practice, False)

For testing, I set the PostbackUrl property of a button to this URL and it worked. If I manually type the URL into the browser it works. Also, if I use Server.transfer it works.

My question is, why is Response.Redirect not working. From what I read, it is preferred to use Response.Redirect compared to Server.transfer. But with that scenerio not working for me, I need to understand why.

I also have some users getting this error randomly.

Error: Missing URL parameter: Name
Stack:    at Microsoft.Reporting.WebForms.EmbeddedResourceOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response)
   at Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

I thought that my Respons.Redirect issue and this may be related, but I did not find us to use the BlueCoatProxy as described in this link (http://jwwishart.wordpress.com/2009/07/17/error-missing-url-parameter-name-in-microsoft-reportviewer-webforms/).

Any help would be greatly appreciated!!
0
Comment
Question by:Recori
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
gyoreg earned 250 total points
Comment Utility
Here come some points, which may help I hope:

- double check, that no output has been sent to the browser when you call the Redirect()

- if you can check the effective http response header, that might help also (you can check it with e.g. FireBug)

- I would also check eventlog, maybe I would put some extra, detailed logging in place

- The type/version of the browser also can take such an effect in extreme cases

- I don't know what do you have in your pdId and Practice variables, and what type they are, but I would use + to concatenate strings, or String.Format(), and would double check that they cannot contain any illegal character.
0
 

Author Comment

by:Recori
Comment Utility
There was nothing in the event log. I did do some of my own logging. Writing to an error log before the response.redirect and immediately after. I am using IE7 on XP.

How can I check if no output was sent to the browser when calling Redirect?

I will check all suggestions tomorrow when I return to work. Getting guidance on the question above would be great too!!

Thanks!!
0
 

Author Comment

by:Recori
Comment Utility
I checked the Response.StatusCode and Response.StatusDescription. It returned 302 and Found. The status at the bottom of IE7 says "Waiting for...." and shows the current page. It is as though nothing is happening.
There is nothing in EventVwr. My logs show it makes it to the Response.Redirect but not to the next page.
Any help is greatly appreciated!
0
 
LVL 16

Assisted Solution

by:Vikram Singh Saini
Vikram Singh Saini earned 250 total points
Comment Utility
Hi,

As you asked, My question is, why  is Response.Redirect not working. From what I read, it is preferred to  use Response.Redirect compared to Server.transfer. But with that  scenerio not working for me, I need to understand why.

I  am trying to explain you the reason but there could be more good reason for the same.

Server.Transfer executes code on the Server side. For e.g. when compiler reaches line Server.Transfer it halts the execution of the rest of the code. So all directing to url (be it absolute or virtual path) is possible in that case.

But in case of Response.Redirect() the request for the new url is made by the browser & it makes request as http://  (I am not sure what is the path here). So the path it is creating at run time might be virtual & so the page is not found. And this could be the answer to why asked by you.

And it works on local system because the virtual path matches the url path in localhost.

However as you said, For testing, I set  the PostbackUrl property of a button to this URL and it worked. If I  manually type the URL into the browser it works. Also, if I use  Server.transfer it works. So can I know what is the actual URL by which you are trying to make it possible.

Hope it helps you to understand.

Regards,
V.S.Saini
0
 

Author Closing Comment

by:Recori
Comment Utility
While none of these solutions solved my problem, they were all very helpful to me as an asp.net newbie. It turns out, I started testing from another, 3rd machine and Response.Redirect was working without problem. So I then got confused/curious and felt it was the IIS server that was causing the problem. So I republished the website under a different folder in IIS and it worked.

Thanks for all the help!!
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

728 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

13 Experts available now in Live!

Get 1:1 Help Now