Recently Viewed...
To help you navigate to pages you most recently visited, select from the links below.
Product Forums
Sharepoint Forums
Benefits of DotNetNuke 4.5
SnowCovered Top Sellers

Version 5 of the perennial best-selling tool for creating data-based solutions in DNN without custom programming. This version focuses on greater flexibility, expandability, and ease-of-use.

Live Content uses Web 2.0 approach to provide a Rich User Interface and streamlines content presentation by overlaying content on current page. Overlay images, videos, audio, text/html content, flash, dotnetnuke modules, and external content. Experience the demo...

Ultra Video Gallery is a brother product of Ultra Media Gallery, UVG allows you to add videos in various format and automatically convert them to flv format, you also can add videos from embed code and play them in our integrated flash video player.

Powerful, Ajax Enabled, Easy to Use. Document Management has never been better. Open-DocumentLibrary allows DotNetNuke users to share and manage documents in a flexible, intelligent way, offering granular control over Folder and Document access.

'Relationship Building' and 'Communication' are two essential nuts and bolts for a business to prosper. This module allows you to bridge both of these and easily generate continuous awareness of your web site, products and services. Your prospects and customers will greatly appreciate this featur

In this day and age, knowing as much detailed information as possible about your customer, prospect or web site user is essential. Thankfully, the new 'Dynamics Forms' module from Data Springs, makes it easier than ever to segment your data collection efforts.

Capture your users attention, enrich your site with multimedia flash, and create and opt in distribution list for your DNN site. These are just a few of the many features the Data Springs Module Collection can provide you.

Ultra Media Gallery is the most popular photo gallery and media gallery solution for DotNetNuke, UMG offers 10 different flash player to browse your gallery with completely different user interface experience.

The Catalyst skins are professionally designed, coded and packaged by a team of DotNetNuke experts. The skins are available in 12 great colours. This skin is easily customisable with our unique DrNuke EasyMod technology. Try our demo!

ALL NEW ! - Minimalist includes skin packs in 12 great colors. Each color has Flat, Gradient and Glass versions. Feature rich XML Flash header, perfect for just about any purpose. 9 Different menu options in each skin pack; 3 horizontal menus, 3 vertical menus and 3 all-new Twin level menus . . .

    |   Register   |   Wednesday, November 19, 2008   
You are here:Resources  Articles & Information  Programming Tips - Application Error Handling  


Secure Programming Tips - Application Error Handling

 

Secure Programming Tips Week 2: Application Error Handling

 

As developers, we become so preoccupied with ensuring our applications work as designed that we often overlook the necessity of unit testing with regard to error handling. For example, if I am passing an ID to another page similar to the example below,

 

http://mysite.com/Details.asp?ID=1

 

I may test this link twenty times to ensure the Details.asp page populates correctly according to the ID value that has been passed. However, I may not even consider testing if the value passed in the ID parameter were something other than a number. After all, a number is what the code expects. So what would happen if we changed the value of the ID parameter from the number 1 to the letter a? Well, if we were doing proper error handling it should error gracefully and the user would be notified that the value supplied was incorrect. On the other hand, if proper error handling wasn’t implemented the user might get the following error:

 

Microsoft VBScript runtime error ‘800a000d’
Type mismatch: ‘[string: “a”]’

 

The primary problem here is we are expecting one type of input, and we aren’t performing proper validation and error handling in the event the type passed is different then what was expected. The above error occurs because the code is expecting a numeric value, but instead receives a string value. The developer wrote the code to expect a number, but didn’t take into consideration the possibility that another type might get passed. Issues like these are easy to remediate. Simply by adding some additional code to validate the type that was passed, such as the code below, the developer could mitigate the risk of the application failing in such an unexpected manner.

 

strValue = Request.Querystring(“ID”)

 

If IsNumeric(strValue) Then

    Call ProcessDetailsPage(strValue)

Else

    Response.Redirect(“ErrorPage.html”)

End If

 

The above code, when implemented, would check to ensure the value passed in the ID parameter met the criterion of being a numeric value. If the validation determined the value was non-numeric, it would then redirect the user to the Error.html page, where a message could be displayed informing the user that the value passed was incorrect.

 

There are occasions where improper error handling can become a major security risk. For instance, assume we pass the letter “a” in the ID parameter as above, but instead of a “Type mismatch” error the user receives the following message:

 

[SQLServer ODBC Driver][SQLServer]Invalid column name ’a’.

 

For those of you who are unfamiliar with it, this type of error message reveals to the user that the application is vulnerable to a SQL injection attack. If this error message were displayed to a malicious user he would have all the information he needs to begin specific targeted attacks against the application. Other types of application error messages that might be used by a malicious user include exposing internal server paths, exposing request headers (i.e. HTTP Referrer, User-Agent, etc.) in the error message, which could be used in an XSS (Cross-Site Scripting) attack or the dump of a stack trace that discloses intimate details about the application’s internal processes.

 

Most languages today are capable of handling errors at the application level. For example, ASP and ASP.NET both contain Application_OnError events within their global.asa and global.asax files, respectively. Below is an example of how global error handling in the global.asax or global.asax.vb file might look in an ASP.NET application.

 

Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)

    Logger.Log(Server.GetLastError())

    Response.Redirect(“ErrorPage.html”)

End Sub

 

When an application error occurs, the above code would log the error to our application log for later analysis. It would then redirect the user to our custom error page, thus preventing the possibility of sending a message to the user that might contain sensitive information, such as one that could inform the user that the application is vulnerable to a specific type of attack. Unfortunately, a lot of developers do not implement proper error handling techniques, but just remember global error handling is your friend, and when implemented properly can be a valuable tool in protecting your application from exposing sensitive information to outsiders.

Thanks, I hope you found this article useful! Please post any comments if you have questions.

 

Feedback Comments
Records per Page
Page 1 of 1First   Previous   Next   Last   
         8/18/2008 8:33:36 PM
qqwwee qweqweqwe

         6/30/2008 7:57:26 AM
Custom Error Pages and send email of error message Using ASP.NET Hi I am working as a asp.net 2.0 programmer. trying to redirect to error page and send an email to admin "if any page gives any type of error it redirect to error page and send mail" please tell me what are the steps i supose to fallow. advance thanks Regards Althaf

Feedback





Enter the code shown above in the box below
Send

 

DNN Modules
SharePoint Web Parts
Flash Image Rotator for SharePoint 2007

Flash Image Rotator Web Part for SharePoint 2007 

 

Who would have thought? Flash with Sharepoint! The FIRST and ONLY flash rotation web part for Sharepoint. The Flash Image Rotator displays selected images and then rotates between the images. Several extended and optional features allow you to select the time to rotate each image, fade between i...more

Price: $129.99
 
Flash News Ticker for SharePoint 2007

Flash News Ticker Web Part for SharePoint 2007 

 

Provide current news items with a user-friendly news ticker for your Sharepoint Portal. With millions of web sites offering information you need a fun way to display information and the solution is Flash News Ticker....more

Price: $139.99
 
View Stock Quote Web Part

Stock Quote Web Part for SharePoint 2007

 

Giving your site visitors relevant information is critical. With the Data Springs Stock Web Part you can provide your users with up to date financial information....more

Price: $149.99
 
Random Image Web Part for SharePoint / MOSS 2007

Random Image Web Part for SharePoint 2007

With Random Image for Sharepoint 2007, you can select multiple images to display randomly when the web part loads...

Price: $139.99
 
SharePoint Charts Web Part

MOSS Charts Web Part for SharePoint 2007

The MOSS Chart Web Part is a web part built by Data Springs for the purpose of rendering several chart types based on data from a SharePoint list on a MOSS 2007 or WSS 3.0 Site ... more

Price: $269.99
 
Copyright 2005 - 2008 by Data Springs, Inc.
Contact Us | Terms Of Use | Privacy Statement