how to trap this error with global.asax?

A

Averell

Hi,

When an user tries to update a record in a gridview with a duplicate value,
there comes an error like:
"The changes you requested to the table were not successful because they
would create duplicate values in the index etc ..."

I tried to solve that with the errorPage like this:
<%@ Page Language="VB" CodeFile="mult.aspx.vb" Inherits="mult"
errorPage="err2.html" %>
and to set in web.config this:
<customErrors mode="On">
</customErrors>

This works, but is this the best way? I would like to do that for all pages
with global.asax.

I did this:
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)
Dim ex As Exception
ex = Server.GetLastError()
Throw ex
End Sub

But of course, there must be more code. But here I'm stuck ...

Any help would be appreciated
Thanks
Averell
 

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,983
Messages
2,570,187
Members
46,747
Latest member
jojoBizaroo

Latest Threads

Top