Solved

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

Posted on 2010-08-18
5
701 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 5

Accepted Solution

by:
gyoreg earned 250 total points
ID: 33469744
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
ID: 33470847
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
ID: 33477011
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
ID: 33482809
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
ID: 33490044
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 Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 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