470,590 Members | 2,525 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,590 developers. It's quick & easy.

Redirect issue

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
Nov 19 '05 #1
5 4049
Try this:

Response.Clear()
Response.Redirect("Demographics.aspx?Quote=" & txtQuoteNum.Text)
Response.End()
"DougS" <do**@nospam.com> wrote in message
news:OG**************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #2
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

Chris Botha wrote:
Try this:

Response.Clear()
Response.Redirect("Demographics.aspx?Quote=" & txtQuoteNum.Text)
Response.End()
"DougS" <do**@nospam.com> wrote in message
news:OG**************@TK2MSFTNGP15.phx.gbl...
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


Nov 19 '05 #3
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

"DougS" <do**@nospam.com> wrote in message
news:OG**************@TK2MSFTNGP15.phx.gbl...
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

Nov 19 '05 #4
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
<sr**********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
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

Chris Botha wrote:
Try this:

Response.Clear()
Response.Redirect("Demographics.aspx?Quote=" & txtQuoteNum.Text)
Response.End()
"DougS" <do**@nospam.com> wrote in message
news:OG**************@TK2MSFTNGP15.phx.gbl...
>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
>

Nov 19 '05 #5
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

"DougS" <do**@nospam.com> wrote in message
news:eF**************@TK2MSFTNGP10.phx.gbl...
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
<sr**********@gmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
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

Chris Botha wrote:
Try this:

Response.Clear()
Response.Redirect("Demographics.aspx?Quote=" & txtQuoteNum.Text)
Response.End()
"DougS" <do**@nospam.com> wrote in message
news:OG**************@TK2MSFTNGP15.phx.gbl...
>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
>


Nov 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Peter Row | last post: by
2 posts views Thread by Brian | last post: by
1 post views Thread by Andy Todd | last post: by
10 posts views Thread by Johnny Fugazzi | last post: by
5 posts views Thread by Seb | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.