by Keyvan Nayyeri via Keyvan Nayyeri on 10/24/2006 4:30:07 AM
One of useful improvements in .NET was around SecurityException class. Newly added properties are really helpful to work with security exceptions.
Previously this object had only four properties but now it comes with several properties (in addition to some properties that it inherits from SystemException) which are listed here:
For example following code throws a SecurityException under ASP.NET Medium Trust which is handled by a SecurityException:
private void ThrowSecurityException()
{
String path = @"C:\Documents and Settings\Keyvan Nayyeri\My Documents\Visual Studio 2005\WebSites\SecurityExceptionExample\keyvan.txt";
try
File.GetAccessControl(path);
}
catch (SecurityException ex)
Response.Write(ex.Action.ToString());
Like many other debugging features in Visual Studio 2005, it provides great debugging support for SecurityExceptions and gives good details about them in order to help troubleshooting for this type of exceptions.
This code throws a SecurityException:
Visual Studio provides this information for the exception that occurs:
Original Post: Improved SecurityException Class in .NET 2.0
The content of the postings is owned by the respective author. CSharpFeeds is not responsible for the contents of the postings. This site is automatically generated and cannot be reviewed for abusive content. If you find abusive content on CSharpFeeds, please contact us. Designated trademarks and brands are the property of their respective owners. All rights reserved.