Connecting Tech Pros Worldwide Forums | Help | Site Map

Exceptions from DLL in ASPX page

Steve
Guest
 
Posts: n/a
#1: Nov 19 '05
Hi... new to ASP.NET... I am creating a DLL using VB.NET which my ASPX
page will be calling. I have a class in the DLL (MyClass) which has a
property (MyProperty). If the value assigned to MyProperty is set by
my ASPX page to be out of bounds, I want to raise an exception that
gets captured in the ASPX page, causing it to fail. This is working
OK. However, when the page fails, in the browser the SOURCE ERROR part
of the error page is showing the code within the DLL where the
exception is thrown. I want it to show the line in the ASPX page that
is in error. Any ideas why this is happening? TIA... Steve


Brock Allen
Guest
 
Posts: n/a
#2: Nov 19 '05

re: Exceptions from DLL in ASPX page


You should enable error redirects:

http://msdn.microsoft.com/library/de...orssection.asp

-Brock
DevelopMentor
http://staff.develop.com/ballen
[color=blue]
> Hi... new to ASP.NET... I am creating a DLL using VB.NET which my ASPX
> page will be calling. I have a class in the DLL (MyClass) which has a
> property (MyProperty). If the value assigned to MyProperty is set by
> my ASPX page to be out of bounds, I want to raise an exception that
> gets captured in the ASPX page, causing it to fail. This is working
> OK. However, when the page fails, in the browser the SOURCE ERROR
> part of the error page is showing the code within the DLL where the
> exception is thrown. I want it to show the line in the ASPX page that
> is in error. Any ideas why this is happening? TIA... Steve
>[/color]


Steve
Guest
 
Posts: n/a
#3: Nov 19 '05

re: Exceptions from DLL in ASPX page


Good info that I didn't know about. However, this seems to deal with a
setting within the web app. I want something in the DLL that will
cause error messages from exceptions to be raised in the ASPX page,
showing the line within the ASPX that is in error. Basically this DLL
will be a commercially marketed component and I don't want the code
inside the DLL to ever be seen by the user (which is currently
happening when the DLL code is shown in the SOURCE ERROR section of the
error page)

Kevin Spencer
Guest
 
Posts: n/a
#4: Nov 19 '05

re: Exceptions from DLL in ASPX page


Try
Handling the Error
Catch Ex As Exception
Do whatever you want to with it
End Try

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Steve" <steven.milz@eglin.af.mil> wrote in message
news:1126555337.466721.260890@g47g2000cwa.googlegr oups.com...[color=blue]
> Good info that I didn't know about. However, this seems to deal with a
> setting within the web app. I want something in the DLL that will
> cause error messages from exceptions to be raised in the ASPX page,
> showing the line within the ASPX that is in error. Basically this DLL
> will be a commercially marketed component and I don't want the code
> inside the DLL to ever be seen by the user (which is currently
> happening when the DLL code is shown in the SOURCE ERROR section of the
> error page)
>[/color]


Brock Allen
Guest
 
Posts: n/a
#5: Nov 19 '05

re: Exceptions from DLL in ASPX page


Right, so as kevin said don't let exceptions propagate outside your API calls
is one way to solve that. But if you need to report back errors via exceptions
(since that is the model) then it's not up to your component if the dev shows
it in the page or not.

-Brock
DevelopMentor
http://staff.develop.com/ballen
[color=blue]
> Good info that I didn't know about. However, this seems to deal with
> a setting within the web app. I want something in the DLL that will
> cause error messages from exceptions to be raised in the ASPX page,
> showing the line within the ASPX that is in error. Basically this DLL
> will be a commercially marketed component and I don't want the code
> inside the DLL to ever be seen by the user (which is currently
> happening when the DLL code is shown in the SOURCE ERROR section of
> the error page)
>[/color]


Kevin Spencer
Guest
 
Posts: n/a
#6: Nov 19 '05

re: Exceptions from DLL in ASPX page


> But if you need to report back errors via exceptions (since that is the[color=blue]
> model) then it's not up to your component if the dev shows it in the page
> or not.[/color]

I suppose I wasn't being too clear. I didn't mean that the DLL classes
should handle the errors. I meant that the client (ASP.Net) application
should handle them, for the most part. I do use some structured exception
handling in my business classes, but usually pass the exceptions up the line
to be dealt with by the client.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.

"Brock Allen" <ballen@NOSPAMdevelop.com> wrote in message
news:b8743b11228108c7868237d1ebbe@msnews.microsoft .com...[color=blue]
> Right, so as kevin said don't let exceptions propagate outside your API
> calls is one way to solve that. But if you need to report back errors via
> exceptions (since that is the model) then it's not up to your component if
> the dev shows it in the page or not.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>[color=green]
>> Good info that I didn't know about. However, this seems to deal with
>> a setting within the web app. I want something in the DLL that will
>> cause error messages from exceptions to be raised in the ASPX page,
>> showing the line within the ASPX that is in error. Basically this DLL
>> will be a commercially marketed component and I don't want the code
>> inside the DLL to ever be seen by the user (which is currently
>> happening when the DLL code is shown in the SOURCE ERROR section of
>> the error page)
>>[/color]
>
>[/color]


Closed Thread