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

C# app: How do I write to a network share using different user credentials?

I'm writing a program that needs to write files to a network share. My problem is that the program users are working on PCs that are not connected to our domain and the program needs to save files to a network share on the domain. It's not feasible to change all of the user accounts on the PCs to match the user's domain credentials so I want to prompt the user for credentials (they all have domain accounts to access Citrix) and then use those credentials to write the file rather than the local PC credentials.

I've searched and read documentation and found various pieces but I have not found a source that shows me how to supply different credentials when I am writing the file. Can anyone help me?

Thanks in advance,

Mike
Oct 4 '07 #1
2 8477
Plater
7,872 Expert 4TB
Well, I am pretty sure it can be done purely in codes/permisions....only I don't know how.

BUT
I did get around it by doing it in a batch file
Expand|Select|Wrap|Line Numbers
  1. NET USE \\computer /user:username password
  2.  
And then
Expand|Select|Wrap|Line Numbers
  1. NET USE /DELETE \\computer
  2.  
(Optionaly, you can change \\computer to \\computer\sharename)


This is not a safe way to do this, but it has worked for us
(remember, for username for domains, it's username@domain and not just username)
Oct 4 '07 #2
Thank your for your reply!

I was hoping to avoid calling net use in the program because there is a chance that the users may already have the resource mapped (but no guarantee). I'm hoping to avoid having to do a lot of configuration on the PCs that this will be deployed on.
Oct 4 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: DotNetUser | last post by:
I know the Domain, UserName, Password and folder on the domain:\\inpsol301\home$\abc Supposed I can use UserName, Password and Window Explore to map the folder above to X: and then write a file...
1
by: GCeaser | last post by:
All, I have a situation where a Server exists in a stand alone workgroup on an Active Directory domain. The server can access domain resources with the correct domain security information...
5
by: Nirosh | last post by:
Hi All, Can any one suggest me a best way to do this .. I have a thrid party tool "EXE" that we need to use with our web service to manipulate some complex XML files, which reside in a...
16
by: JonnyD | last post by:
I am working on a project to build a reporting web app from an exsiting database that is controled by a local application. The application that has control over the database creates a lock file to...
4
by: Jeremy S. | last post by:
We're in the process of writing a new Windows Forms app and the desktop support folks want for it to be run from a network share. I know it's possible (i.e., just have the framework on the clients...
7
by: John.NET | last post by:
Hi, First please forgive that this is a repost as the first time I didn't have my proper nospam email configured... I'm writing a web service where one method will launch another .NET program...
0
by: jonoaustin | last post by:
Hi there I need to be able to copy some files between two different network share locations using credentials other than the logged in user (AD domain based users). Is there a simple way to...
8
by: GaryDean | last post by:
I have a client with a need for multiple app authentication. The apps are all asp.net apps but may be on different servers. The user just wants a single logon and them be free to use five or six...
1
by: Alex | last post by:
Hello, I've written a Console application in VB 2005 which parses some files and stores the results in an MS SQL database. It runs beautifully locally, but as soon as I stick the compiled EXE...
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:
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
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.