Page Load error

M

Morten Snedker

The Response.Redirect("default.aspx") produces an error with the
message "Thread was being aborted.".

What does that mean? Can/should I disregard it?

Try
If Not IsPostBack Then
If Session("JournalNr") <> "" Then
Call Initialize()
Else
Response.Redirect("default.aspx")
End If
End If
Me.txtSelskabsNavn.Focus()

Catch ex As Exception
MsgBox(Err.Number)
ReportError("Page_Load", ex.Message, Session("JournalNr"))
Exit Sub
End Try

Regards /Snedker
 
M

Marina Levit [MVP]

This questions has been asked dozens of times, a quick search could have
saved you time.

Directly from the documentation:
Redirect calls End which raises a ThreadAbortException exception upon
completion.

This means that calling this method always raises this exception - so if you
are catching all exceptions, you will catch this one as well. So either trap
only specific types of exceptions, or take the Redirect out of the Try
block.
 
M

Morten Snedker

This questions has been asked dozens of times, a quick search could have
saved you time.

Your're right - that was a lazy shortcut. Thanks for your reply,
though.

Regards /Snedker
 

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

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top