Redirect issue

D

DougS

I have this code behind a button that does not work:

Dim sQuote As String = txtQuoteNum.Text

Dim iQuote As Int32 = CType(sQuote, Int32)

Dim sUrl As String = "Demographics.aspx?Quote=" & iQuote.ToString

Response.Redirect(sUrl)


I have just deployed this asp.net app to the server and have wierd
response.redirect behavior. Some pages redirect without any issue but this
button does not work. It just blanks out the current page and keeps the
current URL. If I change it to a response.write with the sUrl string and
then past it into the url it works just fine. I'm running framework 1.1

Thanks in advance,
DougS
 
C

Chris Botha

Try this:

Response.Clear()
Response.Redirect("Demographics.aspx?Quote=" & txtQuoteNum.Text)
Response.End()
 
S

sreejith.ram

if what Chris suggested doesnt work, it could be because of some
exception being raised

I would do a try - catch block around those 4 lines to see if any
exception other than ThreadAbort is being raised
 
J

John Timney \(ASP.NET MVP\)

Pass it a fully qualified URL for the redirect and see if that makes a
difference.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
D

DougS

Those are good ideas. I tried this:
Try
Response.Clear()
Response.Redirect("Demographics.aspx?Quote=" & txtQuoteNum.Text)
Response.End()
Catch ex As Exception
Me.lblError.Text = ex.Message
End Try
I still get the same behavior.

I then tried this:
Try
Response.Clear()
Response.Write("http://mydomain/appfolder/Demographics.aspx?Quote="
& txtQuoteNum.Text)
Response.End()
Catch ex As Exception
Me.lblError.Text = ex.Message
End Try

I took the string that resulted from the response.write and pasted it in the
address bar and it worked correctly. Is there some setting I'm missing in
IIS or in my page directives. This is my first ASP.Net app (obviously) and
it's driving me crazy.

Thanks,
DougS
 
D

DougS

I never could figure out why it didnt work. Crazy to spend this much time on
one line of code that should work. I ended up using server.transfer

Thanks,
DougS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,832
Latest member
UtaHetrick

Latest Threads

Top