TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
mdlardizabal
NA
33
0
When do we use Demand and when do we use Assert?
Feb 2 2004 2:15 PM
Hi, I am a newbie in .net security so please bear with me. Normally when I access a resource let say a file, I instantiate a Permission e.g. FileIOPermission FIO = new FileIOPermission(FileIOPermissionAccess.Append | FileIOPermissionAccess.Read | FileIOPermissionAccess.Write, @"C:\TEMP\whatever.txt"); // I do this normally try{ FIO.Demand(); FIO.Assert() // ... write to the file etc. } catch(Exception e) { //... do some exception logging } finally { CodeAccessPermission.RevertAssert(); } My question is this: if I removed the Demand() statement will it affect the way I access the file? I've read that the Demand method walks thru the stack so it may affect my applications overall performance but I haven't noticed any differences when I commented it out. Maybe I am mixing up the two that's why I'm confused. Any help or clarification would be highly appreciated. Hanggang sa muli, Tikbalang.
Reply
Answers (
1
)
System.Security.Cryptography.CryptographicException: Length of the data to decrypt is invalid
Authenticate method of the FormsAuthentication