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

Program runs fine on my computer, won't run on end user computers

I've got an application that I've written in C# that reads and writes to the
filesystem. On the computer I developed the application on, everything works
properly. If I try to run it on another computer that has the .NET 2.0
framework installed but not the SDK, it throws a
system.io.filenotfoundexception the moment it tries to access the filesystem,
even though it does a File.Exists() check before every access.

I've talked to some friends who are professional .NET developers, and they
suspect it's related to Code Access Permissions, but I can't figure out how
I'm supposed to get this assembly trusted on a user's computer when I don't
have mscorcfg.msc or caspol.exe. I'm not going to install the SDK on every
computer that uses the application, and the application is useless without
filesystem access. What should I do?
Feb 25 '06 #1
2 2251
"=?Utf-8?B?RG91ZyBTdHJlaWZlbA==?=" <Doug
St******@discussions.microsoft.com> wrote in
news:67**********************************@microsof t.com:
I've got an application that I've written in C# that reads and
writes to the filesystem. On the computer I developed the
application on, everything works properly. If I try to run it
on another computer that has the .NET 2.0 framework installed
but not the SDK, it throws a system.io.filenotfoundexception the
moment it tries to access the filesystem, even though it does a
File.Exists() check before every access.

I've talked to some friends who are professional .NET
developers, and they suspect it's related to Code Access
Permissions, but I can't figure out how I'm supposed to get this
assembly trusted on a user's computer when I don't have
mscorcfg.msc or caspol.exe. I'm not going to install the SDK on
every computer that uses the application, and the application is
useless without filesystem access. What should I do?


Doug,

From what you've described, I would agree with those other .Net developers.

Code Access Security (CAS) is one of the seemingly mysterious aspects of
..Net. In reality, it's not that hard once you get the hang of it.

This MSDN TV video gives a very good grounding in what CAS is and how it
works. It's only about 13 minutes long, and the examples in the program
use file system permissions to explain CAS:

http://msdn.microsoft.com/msdntv/epi...l/manifest.xml

--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Feb 25 '06 #2
"Doug Streifel" <Doug St******@discussions.microsoft.com> wrote in message
news:67**********************************@microsof t.com...
I've got an application that I've written in C# that reads and writes to
the
filesystem. On the computer I developed the application on, everything
works
properly. If I try to run it on another computer that has the .NET 2.0
framework installed but not the SDK, it throws a
system.io.filenotfoundexception the moment it tries to access the
filesystem,
even though it does a File.Exists() check before every access.
File.Exists should return false your application lacks CAS permissions to
access the file location, so the problem seems may not be purely
CAS-related. Might you be able to post a code extract (incl. the
File.Exists call) that shows how you are attempt to access the files? Also,
could you please post the full exception details (incl. call stack listing),
as returned from its ToString method?

I've talked to some friends who are professional .NET developers, and they
suspect it's related to Code Access Permissions, but I can't figure out
how
I'm supposed to get this assembly trusted on a user's computer when I
don't
have mscorcfg.msc or caspol.exe.
Caspol.exe is installed with the core framework, and it should be present on
all the client machines. It's only the mscorcfg.msc UI that comes only in
the SDK.

I'm not going to install the SDK on every
computer that uses the application, and the application is useless without
filesystem access. What should I do?


First, let's make sure that the problem really is related to CAS. If it is,
you might want to consider deploying it as a ClickOnce application, if
appropriate. If not, it is quite possible to modify CAS policy on machines
that do not have the SDK installed, but you might want to hold off on
worrying about that for now since it might not be necessary.
Feb 27 '06 #3

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

Similar topics

17
by: los | last post by:
Hi, I'm trying to create a program similar to that of Google's desktop that will crawl through the hard drive and index files. I have written the program and as of now I just put the thread to...
5
by: Jeff | last post by:
I wrote a simple VB.NET program that runs on a computer ONLY if I install Visual Studio 2003 on that computer. The computer already had .NET Framework 1.1 installed. If it is run on a computer...
8
by: drose0927 | last post by:
Please help! I can't get my program to exit if the user hits the Escape button: When I tried exit(EXIT_SUCCESS), it wouldn't compile and gave me this error: Parse Error, expecting `'}''...
11
by: bart | last post by:
Hello, I'm so sorry, but i don't understand the concept of the .net environment yet. I made a simple program that retrieves the hostname and ipaddress of the local computer. But when i give...
2
by: William LaMartin | last post by:
I have created a program that allows for the automation of things in Word documents, like changing the values of DocVariables and the links to Excel Sheets. I did it using interoperoperatability,...
2
by: HC | last post by:
Hello, Folks. I am not sure if this can be done (and a brief search of this group didn't yield any results that I thought would do the trick) but if it can be done it would make my life easier so...
43
by: davidkoree | last post by:
I mean not about cookie. Does it have something to do with operating system or browser plugin? I appreciate any help.
1
by: Luc The Perverse | last post by:
Hello! You may remember me as the guy who's trying to learn C# and using that old version 2003 of visual studio. (Although free version of command line .NET compiler is available, so if some new...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...

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.