Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.Redirect works on one computer but not another???

Status
Not open for further replies.

IEAN

Programmer
Sep 13, 2003
122
US
I have an ASP page that does something then Response.Redirect to another ASP page. The response.redirect works fine on my as well as other computer in my company, but the response.redirect fails to redirect on my client's computer. Any idea why? Please advise, thanks!
 
where is the redirect taking the user? Is it possibly an SSL page or something that IE is set to prevent


General FAQ faq333-2924
5 steps to asking a question faq333-3811
 
Being able to see the relevant code may also be somewhat beneficial...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
A redirect is a message from the web server that the requested document is located at a different location.

Most browsers will automatically request the new page when they receive the message... so either your client's browser is not receiving the message or it does not automatically request the new page or it cannot reach the new page.
 
The perfect scenario is the user would feel that they are going from Page A to Page C when in reality the pages are going from
Page A to Page B redirect to Page C, now in my client's page, it just goes from Page A to Page B. It doesn't throw any error, it just stops at Page B. Any ideas? Please advise, thanks!
 
Is the redirect in Page B based on some other requirement being met? Ergo, if the requirements isn't met/true, then it will never hit the redirect statement? Again, without some relevant code (probably from Page B in this case), it is hard to guess what the problem might be...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 

hold on... let me check my all-purpose-crystal-ball[sup]TM[/sup]..

mmmmmm... yep, it's not looking good,.. you've got LackOfDetailOreah and IgnoreChopstikAndShecoItis... it's not life threatening but we might have to operate..

First take a course of ShowUsYourDamnCodeIcilin and come back for a check up in a few minutes - can you also bring us a sample of your code ? The doctors will then try to diagnose....

;-)

JUST IN CASE YOU DIDN'T GET THE SUBTLE HINT:
Please show us your code !!


A smile is worth a thousand kind words. So smile, it's easy! :)
 
ok, the codes are quite long, so I truncated them....

Page A - A create new client form

<form name="NwClient" method="post" action="../NwClient.asp">

<input type="text" name="firstname">
<input type="text" name="lastname">
<input type="text" name="address">
<input type="submit" name="submit" value="submit">


Page B - Insert Info from page A to Database

varFName=Request("firstname")
varLName=Request("lastname")
varAddress=Request("address")

Declare Db connection string etc

SQL=INSERT INTO tblClient (FN,LN,Address) VALUES ('"& varFName &"', '"& varLName &"', '"& varAddress &"')

Execute SQL
Response.Redirect("PageC.asp")


Page C - Clinet Directory

Inserts into DB fine but does not redirect properly...


I hope that gives a better picture of what is going on, thanks again guys for your help!

 
If it's inserting into the database properly (I assume that you *really* truncated your code), then I would place a response.write both before and after your response.redirect and see if they're being hit. I might also try a response.end (judiciously) just after and see if it hits that, too.

Otherwise, nothing stands out in the code sample that you've provided.

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 

yup - as Chopstik points out, test to see if it gets to that point in your code (or even if it goes passed it).

Also, try using an absolute url for the response.redirect parameter, just to be sure..

finally, you may also want to share the browsers being used.. are they all IE? if so which version, or are your clients using Firefox or Opera or something else ?



A smile is worth a thousand kind words. So smile, it's easy! :)
 
Thank you for your responses:

Chopstik Great idea, I will put them in and try it on my client's machine tomorrow and see how it goes since things work perfectly fine on all 4 machines I've tested on, just my client's machine that is giving the problems

DamberMy client is using IE 6.0, Win XP media edition. Great idea, I will change the response.redirect to an absolute url and test it on my client's machine again tomorrow.

One more thing I find weird, as I said before the my client got stuck at Page B, but when he click back to Page A and submit the form again, he can get to page C just fine. So he pretty much as to do it 2 times before things function correctly. Does that ring any bells?
 
Are you passing session variables or querystring variables? If using session variables or cookies, does your client's machine permit them? Otherwise, nothing comes immediately to mind...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Chopstik, I did passed a querystring value but I am not using session or cookies, would the querystring cause problems?

response.redirect("PageC.asp?ClientID="& varClientID &"")
 
Assuming that you have a typo in your line above (with the extra quote at the end), that looks like it should work ok. What would happen if there were no varClientID? I would also response.write that variable just to make sure that something is there...

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
Chopstik, I tested and on my machine the varClientID is passing on fine, as for my clien't machine I have to test it tomorrow. But what I am thing is, even if there is no varClientID, shouldn't my client still land on Page C and at most see error on Page C instead of stuck at Page B?
 
In all likelihood, yes, but it would still be a good thing to see if it is properly generating. Particularly if this is part of a conditional statement that might impact whether or not it even gets to your redirect statement. Nonetheless, we'll see how the tests go tomorrow... Good luck!

------------------------------------------------------------------------------------------------------------------------
"Men occasionally stumble over the truth, but most of them pick themselves up and hurry off as if nothing ever happened."
- Winston Churchill
 
I think your making it all a bit complicated. Why not put PageA, PageB and PageC all in one and use a couple IF statements in?

Like in one of my sites I have an email support form for things, I put a hidden value variable with the querystring, then set that hidden value to that. When the form is submitted, the form disapears when ACTION <> "" and the processing section takes over and then displays results.

Just a thought

<A href="<img src=" border=0></a>
 
I think I'm encountering the same problem with a different ASP program. If your tests are fine on four computers, and you stick on Page B with one, it's a problem with HOW your redirect is executing on that machine, right? I'm still a novice with ASP, but doesn't Response.Redirect call a header? If your client's machine has an over-active privacy setting in its anti-virus (blocking headers - Zone Alarm will block headers), one would anticipate that the form on page A would post to page B, and the Redirect method calls the header to Page C, which is blocked, so the browser stops at Page B. Am I over-simplifying this? Disable your client's anti-virus or firewall and see what happens. IEAN, would Server.Transfer be a better method for directing to Page C? Is there any disadvantage to this? My program is a login program which writes session cookies and redirects using Response.Redirect. It works on 5 of 7 machines I've tried. I just wanted to get a second opinion before I started manipulating code.
 
When I started with ASP I liked to do it the way you have here - user fills out a form, submits it to a page that processes it and then gets sent to another page. I found that as my applications grew it became far more prudent to have pages with forms always submit to themselves. That way the form action is always Request.Servervariables("URL"), so you don't get lost if you have to move or rename a file. Having all of the ASP code to process the form submission at the top of the same page really works well too, you just then redirect to the next page or wherever. I guess it starts to make your form pages more self-contained and the code a lot more efficient, even editing is easier when you can look at the form and the code that processes it on the same page. Just my two cents, and you've already gotten lots of good suggestions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top