473,797 Members | 3,204 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exceptions from DLL in ASPX page

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

Nov 19 '05 #1
5 1540
You should enable error redirects:

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

-Brock
DevelopMentor
http://staff.develop.com/ballen
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

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

Nov 19 '05 #3
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" <st*********@eg lin.af.mil> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.com.. .
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)

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

Nov 19 '05 #5
> 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.
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" <ba****@NOSPAMd evelop.com> wrote in message
news:b8******** *************** ***@msnews.micr osoft.com... 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
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)


Nov 19 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
8563
by: Cool Guy | last post by:
Consider: void Start() { if (!TryToDoSomething()) ShowErrorMessage(); }
5
2278
by: terry | last post by:
Hi, Question: When using Framesets and Server.Transfer in the Application_Error event handler is there a mechanism to get the error page to display in the total view of the browser not just in the offending frame? Overview: I have an application in which I am using framesets. When an Unhandled exception occurs I try to handle it
2
2544
by: Juan Dent | last post by:
Hi, How does one handle exceptions in a Web application? For instance, I have a Page_Load method that throws an ArgumentNullException on some ocassions and I have set the Web.config file with a section like so: <customErrors mode="On" defaultRedirect="ErrorForm.aspx"/> From that page, how can I determine what kind of
5
1450
by: Eric Sabine | last post by:
I have a web site where the user is able to download a file. I can't use an anchor tag because I don't want the user to see where the filename is coming from. Below is the code in which the user clicks to get the file. I could swear this used to work but it definitely doesn't now. Each time at the Response.End() method, I get a System.Threading.ThreadAbortException. I'm not really sure why it is happening. Any clues? Eric Dim...
6
6469
by: Leslie | last post by:
I am attempting to handle errors by using Application_Error. This seems to work fine in most situations. However, if the exception occurs during the Application_Start method, the stand error screen is displayed and my custom error handling in Application_Error does not run. Why does this occur, and is there something I can do to cause Application_Error to be automatically invoked during an Application_Start exception?
6
5260
by: GiddyUpHorsey | last post by:
We have a website built on ASP.NET 2.0. We log exceptions in the Error event of Global.ASAX. We keep a getting number of random exceptions that make no sense and that we can't reproduce but happen everyday. Searching around on the net has revealed no helpful answers. The exceptions are: ---------------- Exception - CryptographicException StackTrace at
1
2391
by: Anonieko | last post by:
Understanding and Using Exceptions (this is a really long post...only read it if you (a) don't know what try/catch is OR (b) actually write catch(Exception ex) or catch{ }) The first thing I look for when evaluating someone's code is a try/catch block. While it isn't a perfect indicator, exception handling is one of the few things that quickly speak about the quality of code. Within seconds you might discover that the code author...
6
2053
by: Liming | last post by:
Hi, In a typical 3 tier model (view layer, busines layer and data access layer) where do you handle your exceptions? do you let it buble up all the way to the .aspx pages or do you handle it in your business layer and/or data access layer? suppose in my data access layer, I provide try and catch, log the exception and re-throw it back to business layer, then in yoru business layer, what do you do? throw it back to the code behind or...
5
2468
by: =?Utf-8?B?QmlsbHk=?= | last post by:
asp.net 2.0 vs2005 What is best practice for exception handling on a website in vs2005? I was going to catch errors in application on_error event, log them to the event log, then send users to an error page. But looking at the event log, asp.net 2.0 logs those errors anyways, with more detail than i cen get from the exception object. So is there any point logging them to the event log, is it jsut better to let .net do this and get the...
0
9537
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10469
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10246
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6803
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5459
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5582
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4135
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3750
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2934
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.