473,385 Members | 1,606 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.

System.IO.File.Exists Method

Hi. I'm building a program which allows users to upload files (located both
on their computer and on our network) onto a file server. However, it
appears that the Internet Guest Account on the webserver must have access to
every possible file location from-which the users are selecting files. If
this access is missing, an exception of type
System.UnauthorizedAccessException occurs.

Obviously its impractical for me to grant the Internet Guest Account access
for all possible network locations.

What should I do to workaround this delima? Is there a workaround?

Thanks!
Mar 21 '07 #1
4 1781
Not sure what you are doing.

The user selects a file (so the user must have access obviously to the file
he want to select). Then server side you get the file content and you save
it were you wish (at a writable place). The server must have write access
only to this place.

For now it would look like if you tried to store those files at their
original location or something similar ?

---
Patrice

"Mike" <Mi**@discussions.microsoft.coma écrit dans le message de news:
F0**********************************@microsoft.com...
Hi. I'm building a program which allows users to upload files (located
both
on their computer and on our network) onto a file server. However, it
appears that the Internet Guest Account on the webserver must have access
to
every possible file location from-which the users are selecting files. If
this access is missing, an exception of type
System.UnauthorizedAccessException occurs.

Obviously its impractical for me to grant the Internet Guest Account
access
for all possible network locations.

What should I do to workaround this delima? Is there a workaround?

Thanks!

Mar 21 '07 #2
Hello Patrice,

Thanks for your response. It turns out I need to turn "Identify
Impersonate=On". Doing this fixed my problem.

"Patrice" wrote:
Not sure what you are doing.

The user selects a file (so the user must have access obviously to the file
he want to select). Then server side you get the file content and you save
it were you wish (at a writable place). The server must have write access
only to this place.

For now it would look like if you tried to store those files at their
original location or something similar ?

---
Patrice

"Mike" <Mi**@discussions.microsoft.coma écrit dans le message de news:
F0**********************************@microsoft.com...
Hi. I'm building a program which allows users to upload files (located
both
on their computer and on our network) onto a file server. However, it
appears that the Internet Guest Account on the webserver must have access
to
every possible file location from-which the users are selecting files. If
this access is missing, an exception of type
System.UnauthorizedAccessException occurs.

Obviously its impractical for me to grant the Internet Guest Account
access
for all possible network locations.

What should I do to workaround this delima? Is there a workaround?

Thanks!


Mar 21 '07 #3
VJ
I think I know what Mike says.. the upload location is different each time,
and how to manage it you are saying... here is a idea..

Upload only to a certain location ( granted writes)
the remote machine runs a localized and authorized process that can move the
file on receive. Of course this process should be listening to receive files

HTH
VJ

"Patrice" <http://www.chez.com/scribe/wrote in message
news:%2*****************@TK2MSFTNGP06.phx.gbl...
Not sure what you are doing.

The user selects a file (so the user must have access obviously to the
file he want to select). Then server side you get the file content and you
save it were you wish (at a writable place). The server must have write
access only to this place.

For now it would look like if you tried to store those files at their
original location or something similar ?

---
Patrice

"Mike" <Mi**@discussions.microsoft.coma écrit dans le message de news:
F0**********************************@microsoft.com...
>Hi. I'm building a program which allows users to upload files (located
both
on their computer and on our network) onto a file server. However, it
appears that the Internet Guest Account on the webserver must have access
to
every possible file location from-which the users are selecting files.
If
this access is missing, an exception of type
System.UnauthorizedAccessException occurs.

Obviously its impractical for me to grant the Internet Guest Account
access
for all possible network locations.

What should I do to workaround this delima? Is there a workaround?

Thanks!


Mar 21 '07 #4
Still look really weird. The server doesn't even access to "every possible
file location from which users are selecting files". Usually the user select
a file. The content is read by the browser (i.e. a client side program) and
sent to a server page that then reads the content (the server doesn't read
from the original location, it just reads what the browser sent).

Glad you solved the problem but you may want to explain what you are doing
as the behavior you have doesn't match the usual upload scheme and would let
me suspect some design problem.

Are you sure this is not a problem when you write the file server side
rather than when you read (how ?) the file in which case impersonation could
be overkill (you could have just granted the needed rights to the storage
location)...

---
Patrice

"Mike" <Mi**@discussions.microsoft.coma écrit dans le message de news:
EB**********************************@microsoft.com...
Hello Patrice,

Thanks for your response. It turns out I need to turn "Identify
Impersonate=On". Doing this fixed my problem.

"Patrice" wrote:
>Not sure what you are doing.

The user selects a file (so the user must have access obviously to the
file
he want to select). Then server side you get the file content and you
save
it were you wish (at a writable place). The server must have write access
only to this place.

For now it would look like if you tried to store those files at their
original location or something similar ?

---
Patrice

"Mike" <Mi**@discussions.microsoft.coma écrit dans le message de news:
F0**********************************@microsoft.com...
Hi. I'm building a program which allows users to upload files (located
both
on their computer and on our network) onto a file server. However, it
appears that the Internet Guest Account on the webserver must have
access
to
every possible file location from-which the users are selecting files.
If
this access is missing, an exception of type
System.UnauthorizedAccessException occurs.

Obviously its impractical for me to grant the Internet Guest Account
access
for all possible network locations.

What should I do to workaround this delima? Is there a workaround?

Thanks!



Mar 22 '07 #5

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

Similar topics

6
by: Chad Crowder | last post by:
Getting the following error on my production server whether the file exists or not: "System.IO.IOException: Cannot create a file when that file already exists." Here's the code generating the...
4
by: DEWright_CA | last post by:
I am trying to see if a file exists in a virtual directory, and if so run a method. I try doing File.Exists and the method runs but the file isn't there. Is there a web version of File.Exists or...
6
by: Don | last post by:
I'm having problems working with a streamwriter object. After closing the streamwriter and setting it to Nothing, I try to delete the file it was writing to, but I always get the following error...
3
by: Lou | last post by:
Question: I can't seem to get file.exists(filename) to return true when I search using wildcards, and I know there's a file in that dir with that extension. here's the path dim yesno as...
1
by: hagaihe | last post by:
Hello, My application is writing relevent events to log file on local machine. Due to amount of transactions i need to open new log everyday and to save the last one according to the next flow: ...
17
by: Peter Duniho | last post by:
I searched using Google, on the web and in the newsgroups, and found nothing on this topic. Hopefully that means I just don't understand what I'm supposed to be doing here. :) The problem: ...
5
by: Ronald S. Cook | last post by:
I'm trying to see if a file exists on a server. I have the below code which doesn't seem to work. Must I necessarily have a mapped drive to that the path starts with X:\ or similar? if...
3
by: trint | last post by:
How can I do this with my c# code with my website(because the file is there, but the code doesn't return it)?: if(File.Exists(String.Format("~/images/categories/{0}", sFileName)) return...
4
by: Brandon McCombs | last post by:
Hello, From my understanding, DirectoryEntry is used to connect to Active Directory. Although this makes no sense whatsoever I accept it. The problem is how am I supposed to test whether a...
7
by: sudhaMurugesan | last post by:
Hi all, I use asp.net with c#. I upload a file and save in a directory. I want to reopen the file so i check for file exists and then open it. But though the file exists, the...
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: 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...
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...

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.