11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

How To: Use Code Access <strong>Security</strong> Policy to Constrain an Assembly 8312. Rebuild the solution.3. Run Iisreset.exe from a comm<strong>and</strong> line to force the ASP.NET process to be recycled.This forces the permission grant for the FileIO assembly to be recomputed. If theASP.NET application domain is still active from the last time you ran the <strong>Web</strong>application, the assembly could still be cached by ASP.NET.4. Run the <strong>Web</strong> application, <strong>and</strong> then click Read File.The contents of the text file should be successfully displayed. The policy that youcreated allows the FileIO assembly to read files from C:\Temp <strong>and</strong> below.5. Enter C:\somefile.txt in the text box, <strong>and</strong> then click Read File.A <strong>Security</strong>Exception should be generated because the code access security policythat you configured does not allow file I/O outside of the C:\Temp directory.The exception details indicate that a request for the FileIOPermission has failed, asshown below:System.<strong>Security</strong>.<strong>Security</strong>Exception: Request for the permission of typeSystem.<strong>Security</strong>.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!