Jump to content
Xtreme .Net Talk

How do I properly use: Response.Redirect("/webpagename.html")


Recommended Posts

Posted

I am having this issue...

 

I have a login form that when users post information to, it will (of course) validate the information.. and based on that information it will either:

A)Response.Redirect("Access.asp")

B)Response.Redirect("/NoAccess.asp")

 

My problem is.. everytime I do a response.redirect.. My vb.net/asp.net code doesn't like it.. The thread reports "Thread was being aborted." in my logs

 

(My response.redirects are in a try of a try/catch and the catch logs the error being "Thread was being aborted." everytime either response.redirect are executed (aka if the user is valide or is not doesn't matter).

 

Any ideas? I don't think javascript redirects are normal for this... So should I just not worry about and not report the "Thread was being aborted." because this is normal (or is it?)?

 

 

thanks!

Lee

Posted

Thank you for your quick reply.

 

Yeah, thatis what i figured :/

 

I was conteplating doing it like this gentelmen suggested:

 

'After your connection openned
Dim bTest1, bTest2 as Boolean
Dim pageRedirect as String
pageRedirect = "default.aspx"  
If( Not bTest1 ) Then
pageRedirect = "fail1.aspx"
End If
If( Not bTest2 ) Then
pageRedirect = "fail1.aspx"
End If
'and so on...
'Close your connection here.
Response.Redirect( pageRedirect )  

 

But if this code is in a function called by another function.. it would still case an issue, am I right?

 

Is there a better way to do this?

 

thanks

 

Lee

Posted

Hmm, my other 2 thoughts were:

1) use Server.Transfer()

2) use a timer... but could timers even be used with webpages? (well outside of javascript that is)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...