473,396 Members | 2,087 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Work around for file permission access error?

When I run my app on a shared drive (J:\ for example), the processing that
should take place doesn't. Running the app from that location in VS.NET
debugger reveals this error:

An unhandled exception of type 'System.Security.SecurityException' occured
in mscorlib.dll.
Additional information: Request for the permission of type
System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0,
Culture=-neutral, PublickKeyToken=b77a5c56193e089 failed.

There a big implementation that might make this work:
http://msdn.microsoft.com/library/de...sctortopic.asp.
I'd like to avoid it in the essense of time. Is there some other create way
to do this? I have administrative rights across the network.

Thanks,
Brett
Nov 21 '05 #1
2 2063
Add your assembly with full trust to the Global Assembly Cache (GAC)

The FileIOPermissions is only a few lines of code, plus the Import.

Imports System.Security.Permissions

Dim fp As New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\")

Try
fp.AddPathList(FileIOPermissionAccess.AllAccess, "C:\AnotherDirectory")
fp.Assert()
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
fp.RevertAssert()
fp = Nothing
End Try

MessageBox.Show("Done")

Crouchie1998
BA (HONS) MCP MCSE
Nov 21 '05 #2
Actually, this worked perfectly:
http://support.microsoft.com/default...en-us;832742#7

The only problem is that .NET Wizard "Trust an Assembly" part seems to not
let you "add" assemblies. If the version on an assembly changes, you have
to go through the wizard again. Any ideas how to get around that? Is there
a way to append?

Thanks,
Brett

"Crouchie1998" <cr**********@spamcop.net> wrote in message
news:Or*************@TK2MSFTNGP12.phx.gbl...
Add your assembly with full trust to the Global Assembly Cache (GAC)

The FileIOPermissions is only a few lines of code, plus the Import.

Imports System.Security.Permissions

Dim fp As New FileIOPermission(FileIOPermissionAccess.AllAccess, "C:\")

Try
fp.AddPathList(FileIOPermissionAccess.AllAccess, "C:\AnotherDirectory")
fp.Assert()
Catch ex As Exception
MessageBox.Show(ex.ToString)
Finally
fp.RevertAssert()
fp = Nothing
End Try

MessageBox.Show("Done")

Crouchie1998
BA (HONS) MCP MCSE

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: fripper | last post by:
When testing a VB .Net application on my system (with IIS installed) I get an error message when using the fileopen function and the file does not exist ... i.e. I want fileopen to create the file....
4
by: Barry Young | last post by:
I have Access 2000 installed on a machine and I create the MDE just fine. When I copy the MDE file over to another machine that has Access 2000 installed, the references are hosed and I get unable...
2
by: Peter O'Reilly | last post by:
I am experiencing difficulty access a mapped network drive in an ASP.NET application. While using the .Net framework v 1.1 implementation of System.IO.Directory.Exists(), it fails to recognize a...
10
by: M K | last post by:
I get the message: 'Could not use ''; file already in use.' on my pages if I am working in the database. I used to be able work in the database (Access) and users use the site, but I tried to...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
15
by: David Thielen | last post by:
Hi; My ASP.NET app (C# calling J# under .net 2.0) creates a png file in a subdirectory to display as part of the created page. However, the bitmap will not display due to a security violation. ...
6
by: scottyman | last post by:
I can't make this script work properly. I've gone as far as I can with it and the rest is out of my ability. I can do some html editing but I'm lost in the Java world. The script at the bottom of...
1
by: igotyourdotnet | last post by:
Ok, here is the issue: I have 2 web pages one does a file upload to a database and the other page does a FTP to a server, both pages use the c:\temp directory. The page that uploads to a database...
0
by: Andy | last post by:
Thanks Peter, I thought I'd give an update on this problem. My application had 2 assemblies that contained classed for the Data access and business logic layer. It was on one of them that I was...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.