473,779 Members | 2,023 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Multiple Domain Authentication in Class Library

HI there

First time poster, long time lurker

I am building a windows class library that will be used on an active
server page. The purpose of the library is to copy files from one
server to another. The number of files to be copied will range
anywhere from 1 to 1000. Seems simple enough, but here's the catch:
the code will be running in domain A and the source files will need to
be copied from Domain B to Domain C. My issue is authentication. I
have tinkered with using the Diagnostics.Pro cess class to run "net
use" commands to connect to the shares on Domains B and C (See
OpenShare method below). The OpenShare function runs just fine and
the "net use" returns with an ExitCode of 0. So, everyhting should be
OK. However, when I attempt to copy files between the shares using
File.Copy, I get "Access Denied" errors. It is as if the shares were
not created. I know that the permissions of the domain users I am
using are sufficient to perform the required operations. Also, the
IUSR that is running the code will be priviledged enough to run
cmd.exe (I know, that may give some heart palpatations, but there are
several other layers of security in place). Any thoughts, ideas, and
criticisms are welcome.
string retval1 = OpenShare(@"\\d omainB\shareB", "userBpassword" ,
"domainB\userB" );
string retval2 = OpenShare(@"\\d omainC\shareC", "userCpassword" ,
"domainC\userC" );

// retval1 and retval2 should each be "0";

try
{
File.Copy(@"\\d omainB\shareB\m yfile.txt",
@"\\domainC\sha reC\myfile.txt" , true);
}
catch(System.Ex ception err)
{
// Do stuff to handle errors...
// err.Message will contain "Access Denied"
}

private string OpenShare(strin g username, string password, string
uncpath)
{
try
{
ProcessStartInf o psi = new ProcessStartInf o();
psi.FileName = "cmd.exe";
psi.Arguments = String.Format("/c net use {0} {1} /user:{2}",
uncpath, password, username);
Process proc = Process.Start(p si);
proc.WaitForExi t();
return "(OpenShare ) " + Convert.ToStrin g(proc.ExitCode );
}
catch(System.Ex ception err)
{
return err.Message;
}
}
Nov 15 '05 #1
0 1271

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

Similar topics

0
2598
by: Tess | last post by:
Hi, Long time reader, first time poster... Any help is appreciated. I have a few questions regarding Winform controls embedded within an html page. For more info please see the appendix. Now, for the questions. 1. A button on my control executes the System.IO.Directory.GetDirectories funtion (the scanned directory resides on the hosting web server). What credentials is this
1
2772
by: Yaron | last post by:
Hi, I am writing a program that will require a user to log in using their domain account which will then take the information to a SQL Server database stored on the server and try to log in using that information. Several questions: 1) What class should I use once I have the username / password to authenticate the account on the domain?
1
1498
by: J-T | last post by:
We are using **NTLM** as the authentication type.If I use this in my ASP.NET application : <identity impersonate="true" username="MyUser" password="123"/> <authentication mode="Windows" /> and MyUser is the local account of the box which hosts my web application ,then can I connect to a remote sql server instance which has exactly the same user name and password defined as ***Sql server authentication* using the connection string...
9
2778
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and wizards. But, I have found that trying to do something "outside the norm" adds a rather large level of complexity and/or data replication. Background I have been commissioned to create a web-based application for a client. It has a formsaunthentication...
11
2227
by: xenophon | last post by:
I have a web site with forms authentication and a single logon page. I have 4 subdirectories, each that should be protected by a different username/password combination. For testing purposes, the username/password are hardcoded into the code-behind C# code. How can I write my web.config to make this happen? Thanks.
4
1689
by: Ryan | last post by:
I am developing an application using ASP.NET 2.0. In this application, I need to provide customized database-driven interfaces based on the domain name that the user is accessing the application from. A list of these domains will be avialable in a data table. What is the most efficient way to determine which domain the application should respond for each time a page is requested. It would seem that executing a SQL query each time a...
22
8942
by: Brett Romero | last post by:
If my UI app uses three DLLs and two of those DLLs reference something named utilities.dll, does the UI app load utilities.dll twice or does the compiler recognize what is going on and load utilities.dll just once? Thanks, Brett
0
1256
by: stevecnz | last post by:
I'm looking for feedback on an authentication solution we are considering for an ASP.NET 2.0 project. The site will be accessed by both internal users who are logged into the Windows domain, and external (business partner) users via the internet. The internal users are required to be authenticated via Windows Integrated Authentication (WIA), and external users will be authenticated using a custom solution based on a signed ticket that...
6
3990
by: Joseph Geretz | last post by:
I have the following class which I am serializing and passing back and forth between my Web Service application and the client. public class Token : SoapHeader { public string SID; public string UID; public string PWD; }
0
9471
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10302
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9925
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8958
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.