Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0HttpException Handling in Custom Module?HttpException Handling in Custom Module?
Previous
 
Next
New Post
10/10/2008 6:51 AM
 

 

HttpException Handling in Custom Module?
 
Dear Forum Readers,
 
I handle (http)exceptions in the module the following way:
 
            MyWebservice.Timeout = 300000 '5 minutes in milliseconds should be enough!
            Dim I As Integer
            For I = 0 To Symbols.Length - 1
                Try
                    MySQString = MyWebservice.GetQuote(Symbols(I).Replace("csv", "AS"))
                Catch
                    Me.Label3.Text = Localization.GetString("WebserviceExceptions", Me.LocalResourceFile)
                    Exit Sub
                End Try
 
When the web service is very busy sometimes the request takes more than 5 minutes and consequently it times out and throws a httpException.
 
Setting:
 
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
 
Then I get these ASP.NET unhandled exception pages:
 
Server Error in '/' Application.
Request timed out.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for
more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Request timed out.
Source Error:
Stack Trace:
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can be
identified using the exception stack trace below.
[HttpException (0x80004005): Request timed out.]
 
Questions:
  1. Why is the exception not handled in my Try-Catch block?
  2. Must I specifically Catch ex As httpException
  3. The idea is that my Try-Catch block captures any kind of exception: http, soap etc!
  4. Why is setting <customErrors mode="Off"/> a security risk? Not that I need it since it does not prevent these ASP.NET unhandled exception pages and it also does not allow my Try-Catch to handle the exception.
  5. Is there a specific DotNetNuke Module exception handling I must apply?
 
Kind regards,
 
Johan van der Galiën.
 
New Post
10/12/2008 9:55 AM
 

HI Johan,

Please never put a try and catch in a for loop, this is bad solution.
I would recommend you put a try catch outside the for loop.

Something like this:
Try
  'Place your for loop here
 
Catch

End Try


I suggest you instead of using a try catch, you check firstly the Symbol Array is not null and a length more than 3 as you are going to replace (CSV which contains 3 characters) with other string so we can avoid the try and catch method.
 

Note: I havent try myself the code, this is just an illustration
ex:
If (Symbol(i) IsNot Nothing) Then

If(Symbol(i).Length >=3 Then
'In Here perform you replace method or other action.
End If
End If

Hope this help

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0HttpException Handling in Custom Module?HttpException Handling in Custom Module?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out