473,385 Members | 1,867 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,385 software developers and data experts.

File Access Error...More

I have a .Net Console Application. I installed it on a server. I created a
bat file on the server which passes the appropriate parms to the program to
run. This application accesses and updates other files on mapped drives.
When I am logged on to the server and run the application, it runs just fine.

When I log on and run from my workstation and double clicking on the bat
file to invoke the application, I get the following error:

Unable to open log file **** Processing Terminated ******
Detail Error Message: Request for the permission of type
System.Security.Permiss
ions.FileIOPermission, mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyT
oken=b77a5c561934e089 failed.

File Name that program was attempting to read was: F:\Products\Batch
Jobs\Metric
BatchLoad\log20054.txt
The file being reference in error is located on the server where the
application resides. I thought maybe when the application was getting the
current directory to find the file to open, that perhaps it was getting
confused (because "f" drive is the name of the mapped drive on my machine,
but "D" is the drive letter which is used on the server. Either way, I get
the same error.

I have signed onto the server where the application is AS WELL as my
WORKSTATION and used the .Net Wizard to grant the application full trust to
the application.

So what am I missing in order to enable me to sign on to my workstation and
double click the bat file to enable me to successfully run the application?

Thanks in advance for your assistance!!
Nov 17 '05 #1
1 1357
Jim,

You've run into the .Net Code Access Security (CAS) system the way
most .Net developers do - trying to run a .Net .EXE from a network
drive.

The .Net runtime gives .EXEs different security permissions depending
upon where the .EXE is run from. An .EXE executed from a local (C:)
drive is given full permissions. That same .EXE run from a network
(F:) drive is only given partial permissions.

Check out this link for an introduction to CAS:

http://msdn.microsoft.com/library/en.../casbasics.asp

The .Net documentation is kind of "dense" when discussing CAS, but
once you get over the initial learning curve, things get easier.

There are more articles about CAS on MSDN, and even a video on MSDN
TV. And here's a .Net security blog:

http://blogs.msdn.com/shawnfa/default.aspx
--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #2

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

Similar topics

9
by: Hans-Joachim Widmaier | last post by:
Hi all. Handling files is an extremely frequent task in programming, so most programming languages have an abstraction of the basic files offered by the underlying operating system. This is...
0
by: Bill Burwell | last post by:
I am converting a VB6 WebClass application to VB.Net. Used the VB upgrade tool to do the conversion - and it left me a lot of little code things to do. Did those code things and got my app to...
5
by: Carl | last post by:
Please can anyone tell me how I can create a macro to save the results of a query as an excel file? The query is called Student List and I would like to save it to "My Documents". We have had...
18
by: Conrad F | last post by:
Hello all, I am waiting for receipt of files in a directory. I use the FileSystemWatcher to detect when files arrive in said folder. I need to read the data from these files ASAP but the files...
0
by: Lokkju | last post by:
I am pretty much lost here - I am trying to create a managed c++ wrapper for this dll, so that I can use it from c#/vb.net, however, it does not conform to any standard style of coding I have seen....
4
by: HNguyen | last post by:
Hi, I have a Web application in ASP.NET. My Application allows the users upload files into the server after checking their user names and passwords. For each transaction, the Web program will...
8
by: Sarah | last post by:
I need to access some data on a server. I can access it directly using UNC (i.e. \\ComputerName\ShareName\Path\FileName) or using a mapped network drive resource (S:\Path\FileName). Here is my...
1
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting"...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am getting an "Access to the path "xxxx" is denied error. I believe is because the file that I am writing to programatically is being read/written to by another end user. These files have the...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.