|
Your explanation is not easy to understand at all, but here goes...
For what I can figure out, you want to write an application that copies a file from one computer to the local computer, on a set schedule. The problem your running into is that your application is getting asked for a username and password when it tries to open the source file. Correct?
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I know it's very hard to understand, but here again:
- My software will copy files from another PCs in the LAN to my PC.
- My LAN is a server-based using Windows 2000 and Active Directory
- When I'm trying to reach the file in the mid night I need a be authiruzied (i mean my software) to be able to reach the file.
I will explain now some of Active Directory Network Basics:
- When a user trys to connect to any PC, Folder, Resource in another PC in the LAN, a dialog will be showed up to enter UserID and Password, that will allow him to connect to this PC. So the server will create an authorization ticket with X minute(s) (as defined in the server), so after X minutes I need to re-provide the password and userID again to reconnect to the remote resource.
- When I want to reach to remote file programatically, This wouln't be happend, so i need to be authorized programmatically.
How could I do that???
I get to the level of reaching the Active Directory programmatically and verifing userID and password, but this has nothing to do with authorization ticket!
rami2k
|
|
|
|
|
Your ActiveDirectory environment is setup a bit differnet than mine. In mine, I don't have to supply credentials to AD to get access to another machine. We're all Domain admins and have access to any machine whenever we need it.
But, for automated processes, like yours, we created accounts in AD that belong to a group at a CN above all the machine we need the process to talk to. This group is a member of all the machines Administrators group. When I launch one of the apps on my machine, all I do is provide it the userID and Password I need it to use, then the app maps a drive to the target computer share, like \\machine\C$. For a quick a dirty solution to that problem, I just created a WScript.Network object, and used that to map the drive, supplying the entered username and password. Then the app just goes and gets the file off that drive letter and path and unmaps the drive. No messaging around with AD is required, no impersonation. Just done...
You could also P/Invoke the WNetUseConnection, WNetAddConnection2, WNetCancelConnection2 functions to accomplish the same thing.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The best way is to run your application as a Windows Service (see ServiceBase in the .NET Framework SDK). This makes sure that it runs all the time and is independent of an interactive session. You could run this as a NetworkService or another special username that has read permissions on the remote server. This is the best way to do this (believe me, I've done things like this before). Having an interactive program is not a good idea in this case.
Specifying a different user's credentials in .NET is not easy. While impersonation is possible, the .NET FCL (Framework Class Library) does not provide full functionality and forces you to P/Invoke a lot of native methods that you need to understand. Fortunately, the documentation for the WindowsIdentity.Impersonate method contains an example.
Still, though, running this program (rather, re-writing it) as a Windows Service running under a network account is a much better way since it runs entirely in the background and you can always use the SCM (ServiceControlManager ) to send simple codes, or .NET Remoting for more advanced control and monitoring.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hello,
I have a windows application made in two formats in C# .net 2003. One is windows client and other is web client. Both communicate with server to get/give the data from/to server.
The windows Application is properly communicating with the server.
In normal senario the program should work in a normal way. i.e. windows client is working in folloing way, first client encrypt the data, send it to server server decrypts it, processes it, encrypt it and send it back where it is decrypted and then used.
But in web application the program communicates with server in diffrent way. It first decrypt the data, where it should have encrypted it and then come series of errors.
My Web.config file looks like below:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<client>
<wellknown
type="RemotingUtility.SecurityClientChannelSinkProvider, RemotingUtility"
url="tcp://localhost:8228/AuthenticateClass.rem"
/>
</client>
<channels>
<channel ref="tcp">
<clientProviders>
<formatter ref="binary" />
<provider type="RemotingUtility.SecurityClientChannelSinkProvider, RemotingUtility"/>
</clientProviders>
</channel>
</channels>
</application>
</system.runtime.remoting>
<system.web>
<!-- regular information -->
</system.web>
</configuration>
Can any one suggest what went wrong? Please help! I dont want to say this but, "Its really urgent". We have to complete our college project at the earliest.
Regards,
Rahul.
|
|
|
|
|
We can't really tell you much if you don't give us more information about the errors. What exception(s) are you getting? What's the exception message? Is the data encrypted or not?
Also keep in mind that ASP.NET runs with a set of permissions. Depending on the permission set that ASP.NET is run under, .NET Remoting may not be allowed.
Read Understanding .NET Code Access Security[^] for a good overriew of CAS as well as links to more information.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear Sir,
Thanks for a reply, this is my college project which needed attention desperatly.
Should I send you the complete code?
Please assist!
Rahul.
|
|
|
|
|
If it's your collage project, should you be asking for someone else do you it for you?
Aaron Eldreth
TheCollective4.com
My Articles
While much is too strange to be believed,
Nothing is too strange to have happened.
- T. Hardy
|
|
|
|
|
Dear Sir,
>>If it's your collage project, should you be asking for someone else do you it for you?
I am sorry if you interpreted it like that but its not true. I am new to remoting. More over at my place no books of remoting are availabe. Every body here is living in past vith VB/VC++ 6.0.
Rest, I assure you there is a problem which i am not able to fix. I need just help to fix it. I will make my project myself. Like i have done till date, of course i need help and guidance from experts like you.
Thanks for your concerns,
Regards,
Rahul.
|
|
|
|
|
If you're new, than either you shouldn't have chosen it for your project or you should learn it - part of the point of a project.
There are plenty of books available about .NET Remoting that are for beginning and intermediate developers, and contain concepts for advanced developers as well.
See "Microsoft .NET Remoting" from MS Press[^] and/or "Advanced .NET Remoting" from Ingo Rammer[^].
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Dear Sir,
I have found the solution to the problem. Now, if you can please assist me to put it right.
Please assist...
it goes like this... Program is not reading web.config file. If it is specified at the click event of buttion like
RemotingConfiguration.Configure(@"C:\Inetpub\wwwroot\RemotingClient\Web.config");
the program works fine. How can i fix it?
1. The Url of the config file is not proper. I have tried all possible combinations but it is not working.
2. If second click is performed, even after restarting the page and server it gives an error that channel is already registered.
Please Assist...
Thanks for your kind help and great Example
Regards,
Rahul.
|
|
|
|
|
.NET Remoting does not read the .config file automatically. To do, get the path to the .config file using AppDomain.CurrentDomain.SetupInformation.ConfigurationFile to get the path programmatically. Then call RemotingConfiguration.Configure with the return value of that property.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Hi,
I'd like to write a stealth windows application that logs what files a user downloads. I would like to use the application to perform trend analysis, what files(jpegs, gifs or mpegs etc) a user downloads the most. Using C# I would like to know the logic behind it!
eg. User clicks on a button or href to download file.
My app logs user downloading file from site
Any ideas will be much appreciate it..!
|
|
|
|
|
You would essentially be writting a firewall. A low-level application that the .NET Framework is NOT suited for. You'll be P/Invoking ALOT of Win32 API calls yourself.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You could also write a Browser Helpfer Object (BHO). It's an ActiveX control that can sink the connection points in Internet Explorer, similar to how IE toolbars and desk bands work (though no GUI is required).
See Browser Helper Objects: The Browser the Way You Want It[^] for more information.
While you could create a BHO using C# and exposing a CCW (COM-Callable Wrapper), it would be pretty slow with the extra marshaling overhead. I suggest writing one in C/C++ if you know it - it's really not too hard.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
BHO's will work only with IE and Windows Explorer. They will not work with Netscape Navigator, or Mozilla, ...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
this is control listview
1. I also alternate colors of rows
between gray and white. Now at Control Listview
2. I want change Color header at Control Listview
but ...i can not it
Please help me
Thank you
|
|
|
|
|
please write little clear.
Sreejith S S Nair
|
|
|
|
|
The ListView control doesn't natively support alternating colors for ListViewItem 's or changing the Header Background color. You would have to ownerdraw the ListView control yourself to get that kind of functionality.
Check into articles on CodeProject here[^] and here[^]. Also on CodeGuru here[^].
RageInTheMachine9532
"...a pungent, gastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Does anyone know how I can get my property that is a member of my Component, so show up in the Dynamic Properties section of the property editor? I want to bind it to the app.config file, and I expect it to appear in the designer so I can bind easily through the IDE... (did I explain that clear enough?)
Thanks!
~Steve
|
|
|
|
|
The following attribute will place FirstName within the Dynamic Properties and then the Advanced section.
private string _name;
[Category("(DynamicProperties)")]
public string FirstName
{
get{return _name;}
set{_name = value;}
}
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks!! "CategoryAttribute" was one I wasn't familiar with...
~Steve
|
|
|
|
|
You should take a look at the classes in the System.ComponentModel namespace for more helpful design-time attributes and more. A good section to read if you're new to design-time extensibility is Enchancing Design-Time Support[^] in the .NET Framework SDK documentation.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Great stuff! Thanks Health and Nick. Yes, I'm new to .NET entirely, and am very impressed with what I'm seeing so far. Thanks for the tips and pointers...
~Steve
|
|
|
|
|
I have seen a document somewhere I can design the window form shape to be circular, instead of traditional rectangle shape. Can anyone help? I'm thinking of making this round shape for about box. Something unique.
That's in Visual.net C# language. Thanks!
Ron Boucher
|
|
|
|