Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Response.redirect


Message #1 by Anupama Nallari <ANallari@p...> on Mon, 26 Nov 2001 17:38:50 -0600

I am using response.redirect to redirect the user to another page after data

entry. I insert a new record into a SQL database and after executing the

stored procedure to insert the record into the database I have the statement

response.redirect("openreq.asp"), this line of code does not work the user

is not redirected to the other page instead the same page comes up.



Any clue as to why this is happening?



Thanks,

Anu

Message #2 by Mark Eckeard <meckeard2000@y...> on Mon, 26 Nov 2001 17:04:29 -0800 (PST)
Anu,



Post your code exactly as you have it.  Maybe we can

help shed some light on the problem.



Mark.

--- Anupama Nallari <ANallari@p...> wrote:

> 

> I am using response.redirect to redirect the user to

> another page after data

> entry. I insert a new record into a SQL database and

> after executing the

> stored procedure to insert the record into the

> database I have the statement

> response.redirect("openreq.asp"), this line of code

> does not work the user

> is not redirected to the other page instead the same

> page comes up.

> 

> Any clue as to why this is happening?

> 

> Thanks,

> Anu

> 

>  



> meckeard2000@y...


> $subst('Email.Unsub')

> 





__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1

Message #3 by Anupama Nallari <ANallari@p...> on Tue, 27 Nov 2001 08:43:24 -0600

Mark,

This is the asp code that I have for this page.



Thanks,

Anu





				<%if Request.Form("submitreq")="Submit" then

						stremail=""

	

stremail=Request.Form("email")

						for k=1 to len(stremail)

							if

mid(stremail,k,1)<>"@" then

	

blnexists=false

							else	

	

blnexists=true

								exit for

							end if

						next

						for k=1 to len(stremail)

							if

mid(stremail,k,1)<>"." then

	

blndexists=false

							else

	

blndexists=true

								exit for

							end if

						next

		

				if blnexists=false or blndexists=false

then%>

					<SCRIPT LANGUAGE=javascript>

						<!--

									

						window.alert("Invalid email

address. The email address needs to have @ symbol and . in the address.

Re-enter email address.")

						window.newreq.email.focus()

						 

						//-->

					</SCRIPT>

		

			<%	end if%>



			<%strtelno=Request.Form("conphone")

				for k=1 to len(strtelno)

				if (asc(mid(strtelno,k,1))>= 48 	and

asc(mid(strtelno,k,1)) <=57 )then

				blntelerror=false

				else

					if asc(mid(strtelno,k,1)) = 45 or

asc(mid(strtelno,k,1))=40 or  asc(mid(strtelno,k,1))=41 or

asc(mid(strtelno,k,1))=32 then

						blntelerror=false

					else

						blntelerror=true

						exit for

					end if

				end if

	

			next%>

	

<%if blntelerror=true and blnexists=true and blndexists= true then%>

	<SCRIPT LANGUAGE=javascript>

	<!--

						

	window.alert("Invalid telephone number. Only numbers and the -

symbol can be entered in this field. Re-enter telephone number.")

	window.newreq.conphone.focus()

		     

	//-->

	</SCRIPT>

	<%else

		if blntelerror=false and blnexists=true and blndexists=true

then

			Set cmd = Server.CreateObject("ADODB.Command")

			set cmd.ActiveConnection = myconn

				cmd.CommandType = adCmdStoredProc

				cmd.CommandText = "spkf_putrequest"

	

			

			Set prmUserID = cmd.CreateParameter ("UserID",

adVarChar, adParamInput, 15,session("userid"))

			Set prmCompanyID = cmd.CreateParameter ("CompanyID",

adInteger, adParamInput,4,session("companyID"))

			Set prmContactEmail = cmd.CreateParameter

("ContactEmail", advarchar, adParamInput,80,stremail)

			Set prmContactPhone = cmd.CreateParameter

("ContactPhone", advarchar, adParamInput,15,Request.Form("conphone"))

			Set prmCustPriorityID = cmd.CreateParameter

("CustPriorityID", adinteger,adParamInput,,Request.Form("priority"))

			Set prmProblemDesc = cmd.CreateParameter

("ProblemDesc", advarchar, adParamInput,8000,Request.Form("probdesc"))

			if session("filename")="" then

			set prmFilelocation 

cmd.createParameter("Filelocation",adVarChar,adParamInput,200," ")

			else

			set prmFilelocation 

cmd.createParameter("Filelocation",adVarChar,adParamInput,200,session("filen

ame"))

			end if

			

			Set prmReturnValue = cmd.CreateParameter

("ReturnValue", adinteger, adParamOutput)

			//the stored procedure is getting executed.



			cmd.Parameters.Append prmUserID

			cmd.Parameters.Append prmCompanyID

			cmd.parameters.append prmContactEmail 

			cmd.parameters.append prmContactPhone

			cmd.parameters.append prmCustPriorityID 

			cmd.parameters.append prmProblemDesc

			cmd.parameters.append prmFilelocation

			cmd.Parameters.Append prmReturnValue

			cmd.EXECUTE

			ReturnValue = prmReturnValue.Value

			session("firstlist")="true"

			session("filename")=""

			//This line does not work.

			Response.Redirect("openreq.asp")

		end if

	

end if



end if%>

Message #4 by Mark Eckeard <meckeard2000@y...> on Tue, 27 Nov 2001 10:14:34 -0800 (PST)
Anu,



I would start by testing this line:



"if blntelerror=false and blnexists=true and

blndexists=true then"



Do a response.write right after this line to ensure

that is evaluating correctly.  Then let me know the

response.



Mark



--- Anupama Nallari <ANallari@p...> wrote:

> 

> Mark,

> This is the asp code that I have for this page.

> 

> Thanks,

> Anu

> 

> 

> 				<%if Request.Form("submitreq")="Submit" then

> 						stremail=""

> 	

> stremail=Request.Form("email")

> 						for k=1 to len(stremail)

> 							if

> mid(stremail,k,1)<>"@" then

> 	

> blnexists=false

> 							else	

> 	

> blnexists=true

> 								exit for

> 							end if

> 						next

> 						for k=1 to len(stremail)

> 							if

> mid(stremail,k,1)<>"." then

> 	

> blndexists=false

> 							else

> 	

> blndexists=true

> 								exit for

> 							end if

> 						next

> 		

> 				if blnexists=false or blndexists=false

> then%>

> 					<SCRIPT LANGUAGE=javascript>

> 						<!--

> 									

> 						window.alert("Invalid email

> address. The email address needs to have @ symbol

> and . in the address.

> Re-enter email address.")

> 						window.newreq.email.focus()

> 						 

> 						//-->

> 					</SCRIPT>

> 		

> 			<%	end if%>

> 

> 			<%strtelno=Request.Form("conphone")

> 				for k=1 to len(strtelno)

> 				if (asc(mid(strtelno,k,1))>= 48 	and

> asc(mid(strtelno,k,1)) <=57 )then

> 				blntelerror=false

> 				else

> 					if asc(mid(strtelno,k,1)) = 45 or

> asc(mid(strtelno,k,1))=40 or 

> asc(mid(strtelno,k,1))=41 or

> asc(mid(strtelno,k,1))=32 then

> 						blntelerror=false

> 					else

> 						blntelerror=true

> 						exit for

> 					end if

> 				end if

> 	

> 			next%>

> 	

> <%if blntelerror=true and blnexists=true and

> blndexists= true then%>

> 	<SCRIPT LANGUAGE=javascript>

> 	<!--

> 						

> 	window.alert("Invalid telephone number. Only

> numbers and the -

> symbol can be entered in this field. Re-enter

> telephone number.")

> 	window.newreq.conphone.focus()

> 		     

> 	//-->

> 	</SCRIPT>

> 	<%else

> 		if blntelerror=false and blnexists=true and

> blndexists=true

> then

> 			Set cmd = Server.CreateObject("ADODB.Command")

> 			set cmd.ActiveConnection = myconn

> 				cmd.CommandType = adCmdStoredProc

> 				cmd.CommandText = "spkf_putrequest"

> 	

> 			

> 			Set prmUserID = cmd.CreateParameter ("UserID",

> adVarChar, adParamInput, 15,session("userid"))

> 			Set prmCompanyID = cmd.CreateParameter

> ("CompanyID",

> adInteger, adParamInput,4,session("companyID"))

> 			Set prmContactEmail = cmd.CreateParameter

> ("ContactEmail", advarchar,

> adParamInput,80,stremail)

> 			Set prmContactPhone = cmd.CreateParameter

> ("ContactPhone", advarchar,

> adParamInput,15,Request.Form("conphone"))

> 			Set prmCustPriorityID = cmd.CreateParameter

> ("CustPriorityID",

> adinteger,adParamInput,,Request.Form("priority"))

> 			Set prmProblemDesc = cmd.CreateParameter

> ("ProblemDesc", advarchar,

> adParamInput,8000,Request.Form("probdesc"))

> 			if session("filename")="" then

> 			set prmFilelocation 

>

cmd.createParameter("Filelocation",adVarChar,adParamInput,200,"

> ")

> 			else

> 			set prmFilelocation 

>

cmd.createParameter("Filelocation",adVarChar,adParamInput,200,session("filen

> ame"))

> 			end if

> 			

> 			Set prmReturnValue = cmd.CreateParameter

> ("ReturnValue", adinteger, adParamOutput)

> 			//the stored procedure is getting executed.

> 

> 			cmd.Parameters.Append prmUserID

> 			cmd.Parameters.Append prmCompanyID

> 			cmd.parameters.append prmContactEmail 

> 			cmd.parameters.append prmContactPhone

> 			cmd.parameters.append prmCustPriorityID 

> 			cmd.parameters.append prmProblemDesc

> 			cmd.parameters.append prmFilelocation

> 			cmd.Parameters.Append prmReturnValue

> 			cmd.EXECUTE

> 			ReturnValue = prmReturnValue.Value

> 			session("firstlist")="true"

> 			session("filename")=""

> 			//This line does not work.

> 			Response.Redirect("openreq.asp")

> 		end if

> 	

> end if

> 

> end if%>

> 

>  



> meckeard2000@y...


> $subst('Email.Unsub')

> 





__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1

Message #5 by "Ken Schaefer" <ken@a...> on Wed, 28 Nov 2001 11:28:14 +1100
I suggest you do a Response.Write immediately after the Response.Redirect

line.

My guess is that your conditional logic is a little mixed up, and neither

the stored procedure, nor the Response.Redirect is being called.



Also, you might want to look here:

www.adopenstatic.com/resources/code/UIValidation.asp

for a cleaner way to write your validation system



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Anupama Nallari" <ANallari@p...>

Subject: [asp_databases] Re: Response.redirect





:

: Mark,

: This is the asp code that I have for this page.

:

: Thanks,

: Anu

:

:

: <%if Request.Form("submitreq")="Submit" then

: stremail=""

:

: stremail=Request.Form("email")

: for k=1 to len(stremail)

: if

: mid(stremail,k,1)<>"@" then

:

: blnexists=false

: else



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #6 by Anupama Nallari <ANallari@p...> on Tue, 27 Nov 2001 19:16:40 -0600
ken,

The problem is that the stored procedure written before the

response.redirect is getting excecuted and a record is getting inserted into

the sql database, so I do not see why this particular line is not getting

executed, it is part of the same if endif statement.



Thanks,

Anu





-----Original Message-----

From: Ken Schaefer [mailto:ken@a...]

Sent: Tuesday, November 27, 2001 6:28 PM

To: ASP Databases

Subject: [asp_databases] Re: Response.redirect





I suggest you do a Response.Write immediately after the Response.Redirect

line.

My guess is that your conditional logic is a little mixed up, and neither

the stored procedure, nor the Response.Redirect is being called.



Also, you might want to look here:

www.adopenstatic.com/resources/code/UIValidation.asp

for a cleaner way to write your validation system



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Anupama Nallari" <ANallari@p...>

Subject: [asp_databases] Re: Response.redirect





:

: Mark,

: This is the asp code that I have for this page.

:

: Thanks,

: Anu

:

:

: <%if Request.Form("submitreq")="Submit" then

: stremail=""

:

: stremail=Request.Form("email")

: for k=1 to len(stremail)

: if

: mid(stremail,k,1)<>"@" then

:

: blnexists=false

: else



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





 




$subst('Email.Unsub')



Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid

=rn_ebooks

Message #7 by Mark Eckeard <meckeard2000@y...> on Tue, 27 Nov 2001 18:07:35 -0800 (PST)
Anu,



Response.write everything. The data that you would

insert into the DB.  Even "test" outputs to the page

before and after the response.redirect.  Since this is

not an easy one to just look at and see the error, it

might take a little debugging to find the problem.  



I would start by eliminating the insert into the DB. 

If you write out the data to the page instead of

inserting it and the redirect works, you can atleast

find the area of the problem.  It would be the SQL

portion of your code.  



Take it a small piece at a time and let us know how it

goes.



Mark

--- Anupama Nallari <ANallari@p...> wrote:

> ken,

> The problem is that the stored procedure written

> before the

> response.redirect is getting excecuted and a record

> is getting inserted into

> the sql database, so I do not see why this

> particular line is not getting

> executed, it is part of the same if endif statement.

> 

> Thanks,

> Anu

> 

> 

> -----Original Message-----

> From: Ken Schaefer [mailto:ken@a...]

> Sent: Tuesday, November 27, 2001 6:28 PM

> To: ASP Databases

> Subject: [asp_databases] Re: Response.redirect

> 

> 

> I suggest you do a Response.Write immediately after

> the Response.Redirect

> line.

> My guess is that your conditional logic is a little

> mixed up, and neither

> the stored procedure, nor the Response.Redirect is

> being called.

> 

> Also, you might want to look here:

> www.adopenstatic.com/resources/code/UIValidation.asp

> for a cleaner way to write your validation system

> 

> Cheers

> Ken

> 

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> From: "Anupama Nallari" <ANallari@p...>

> Subject: [asp_databases] Re: Response.redirect

> 

> 

> :

> : Mark,

> : This is the asp code that I have for this page.

> :

> : Thanks,

> : Anu

> :

> :

> : <%if Request.Form("submitreq")="Submit" then

> : stremail=""

> :

> : stremail=Request.Form("email")

> : for k=1 to len(stremail)

> : if

> : mid(stremail,k,1)<>"@" then

> :

> : blnexists=false

> : else

> 

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> 

> 

>  



> anallari@p...


> $subst('Email.Unsub')

> 

> Read the future with ebooks at B&N

>

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid

> =rn_ebooks

> 

>  



> meckeard2000@y...


> $subst('Email.Unsub')

> 

> Read the future with ebooks at B&N

>

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid=rn_ebooks





__________________________________________________

Do You Yahoo!?

Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.

http://geocities.yahoo.com/ps/info1

Message #8 by "Ken Schaefer" <ken@a...> on Wed, 28 Nov 2001 14:34:53 +1100
Do you have On Error Resume Next in your code? If so, take it out please.



I just noticed that you are using VBScript for the server-side scripting,

but you have JScript commenting (//) in your code. That should raise an

error if error handling isn't enabled.



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Anupama Nallari" <ANallari@p...>

Subject: [asp_databases] Re: Response.redirect





: ken,

: The problem is that the stored procedure written before the

: response.redirect is getting excecuted and a record is getting inserted

into

: the sql database, so I do not see why this particular line is not getting

: executed, it is part of the same if endif statement.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index