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

C# and file system

Hi.
Can anyone help me with the following problem?
I have a desktop application. The language is C#. I want to access a
directory on a server through this application. Not with http or ftp (using
the 'directory' object). The problem is that I am not user of this server.
Even if I was (I can do that) I do not login in this server. How can I force
the server to prompt me for a login and a password or even better how can I
send these crendentials with a command in order to get access the file
system. Am I using the wrong object? If yes what object can I use?

Thank you in advance.

George Varelas
Nov 15 '05 #1
1 1367
George,

If you were a user on the domain where the server is located, you could
imitate that user by making a call to the LogonUser API function in the
Win32 API. Once you have a handle, you can use the WindowsIdentity class to
impersonate that handle (through a call to the Impersonate method). The
documentation for the Impersonate method will show you how to do this.

Once you do this, you can use the classes in the System.IO namespace to
perform the operations on the files that you need to perform.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"George Varelas" <gv******@cti.gr> wrote in message
news:Ob**************@TK2MSFTNGP11.phx.gbl...
Hi.
Can anyone help me with the following problem?
I have a desktop application. The language is C#. I want to access a
directory on a server through this application. Not with http or ftp (using the 'directory' object). The problem is that I am not user of this server.
Even if I was (I can do that) I do not login in this server. How can I force the server to prompt me for a login and a password or even better how can I send these crendentials with a command in order to get access the file
system. Am I using the wrong object? If yes what object can I use?

Thank you in advance.

George Varelas

Nov 15 '05 #2

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

Similar topics

7
by: Atila Olah | last post by:
I'm working on a project to implement a simple cross-platform file sharing protocol (using Python) that is similar to HTTP, and I have to write a GUI for Windows and Linux. But let's start with the...
17
by: Carmen Wai | last post by:
Hello: I would like to know whether there is any different in installing Postgresql on the Linux system with file system of EXT2 or EXT3. I have two machines with idential OS (Red Hat 7.3...
7
by: Allen Anderson | last post by:
I'm trying to figure out a way to catch when a file has been written to a directory. I currently have it where I can catch when the file begins writing, but this isn't helpful as I need to know...
2
by: Jack David | last post by:
Using the code below I am able to monitor a single directory for a new file and then kick-off a process to deal with the file. The question is??? How would I modify this code to be able to monitor...
5
by: ToddT | last post by:
i've got one app that writes large files to a specific directory that is watched by another app via an instance of the file system watcher class. my problem is that the second app is notified when...
4
by: Tom C. | last post by:
Does anyone know how to add the File System Editor to a Visual Studio 2003 installation? Thanks!
4
by: RedHair | last post by:
I'd like to set up a file system for the ASP.NET 2.0 application to store user-uploaded files, since the members are more than 100,000 people, the basic requirements are as below: (1) The file...
5
by: Raj | last post by:
What is the purpose of file system caching while creating a tablespace? Memory on the test server gets used up pretty quickly after a user executes a complex query(database is already activated),...
11
by: Tarren | last post by:
Hi: I need to get the unique GUID for a file, so I am using API calls through System.InteropServices I am using BY_HANDLE_FILE_INFORMATION and
2
by: John_Doe | last post by:
Can anyone clarify what the difference between these two choices is when developing website? I have IIS installed too, so I can pick this too if there is a reason. From the point of view of...
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
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
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
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: 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.