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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Response.redirect won't fire? 1

Status
Not open for further replies.

timcadieux

Programmer
May 25, 2005
129
BE
I'm using th ebelow code to add to my DB then i want it to go back to my main page. It does add the info, but it just site on "Category Addded". I'm using the exact same code for my DELETE AND EDIT Functions and they work fine?
Code:
						Set rs = Server.CreateObject("ADODB.Recordset")
						strSQL = "SELECT * FROM Categories WHERE CategoriesID=0;"
						rs.Open strSQL, Application("Connection1_ConnectionString") , adOpenKeyset, adLockPessimistic, adCmdText
					
						'Add a record to the Category Table
						rs.AddNew  
							rs.Fields("Category").Value = request.form("category")
						rs.Update
				
						rs.Close
						Set rs = Nothing						
						response.Write("Category Added")
						response.Redirect("0_6_1_0.asp")
						'Server.Execute("0_6_1_0.asp")
 
It looks ok to me. As a test, add a response.write statement after your redirect code and see if it will hit that. If so, then it's an issue with the redirect statement. Otherwise, nothing is staring out at me.

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
I did, i used the response.Write("Category Added") and it displays that, but that's all it displays.
 
I even added incorrect code to throw an error but it it only shows me the Text i display to the user "Category Edited"

Code:
					response.Write("Category Edited")
					response.redirect("///0_6_1_0.asp.asp")
 
In which case, it appears that it is not even hitting that line. What happens if you take out the response.write("Category Edited") code and let it simply redirect immediately after setting your recordset to nothing?

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
One other thought. Try putting a Response.Clear statement before you try your Redirect.
Code:
Response.Write ("Category Edited")
Response.Clear
Response.Redirect ("thisPage.asp")

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
This does abslutely nothing.
Code:
					'response.Write("Category Edited")
					response.redirect("///0_6_1_0.asp.asp")
 
I just noticed something, this does NOT work on our Staging server, but it DOES on the Production....is it possible to disable that feature on a server?
 
Does it work for none of your other pages (the updates and deletions) in Staging as well? Or is it still just this one page that is affected? Have you turned buffering on/off on the affected page? (That is the purpose of the Response.Clear in my previous post.) Otherwise, I'm not seeing anything that rings any bells.

You can enable/disable buffering on the web server, which I suppose could cause this problem. But again, is it only this page that is affected or are others also impacted?

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
Well, none of the above has helped, but I know for a fact there are differences between both servers, this could just be one more...i've made a workaround.

thx!
 
What is the workaround, if you don't mind my asking for future posters who may also encounter this problem?

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
That's just plain bizarre...

it's started working, but i did that Response.Buffer=True before lunchtime! it's like if there was a lag in the files being updated!

Anyhow, it's working now, thx everyone!
 
it's like if there was a lag in the files being updated

It is possible that the older version of the file was cached and you were still hitting that instead of the new version. Try holding down the shift key when you click refresh and see if that helps.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
tsdragon, just for my own curiosity, what benefit would holding the SHIFT button provide when refreshing?

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
I believe he meant CTRL - it forces the browser to really go back to the page.
 
No, holding shift and refreshing the page should force the browser to ignore the contents of the cache folder (and over-write if needed), so that your not reloading old images/files.
 
Yup, that's what it is supposed to do. It seems to work, too. I've found it especially useful when you're changing an included file (especially a style sheet), as they seem to be cached quite frequently.

And I'm pretty sure it is shift, not ctrl. But I've been doing it so long that I can't even remember which key I hit. It's just a reflex.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Thanks for that tidbit, Tracy! It's often the little things that help make things go better... [thumbsup]

------------------------------------------------------------------------------------------------------------------------
"I am not young enough to know everything."
Oscar Wilde (1854-1900)
 
OK, I just did a google search on both "shift refresh" and "ctrl refresh" and I'm still not certain. I got about the same number of hits for both. Many entries say just hit shift-refresh to force a full page reload. However, some entries say that in IE you have to use ctrl-refresh to do that (shift-refresh being the same as without the shift). Now I'm even more confused! As long as using the shift key seems to be working for me, I'll stick with that.

Tracy Dryden

Meddle not in the affairs of dragons,
For you are crunchy, and good with mustard. [dragon]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top