I’m trying to write a file to another machine (not on the same domain), using a share that is available on that machine. I saw this question, using StreamWriter on server in C# , and I guess the person who asked the question got the answer, but I’m not use exactly how to do this. THe MSDN article it points to requires you to make a whole class to support an impersonation – is there no easier way to do this? Can I make a user on my machine that can do something like that? Can I set up my asp.net user to impersonate, or run IIS using a different user?
Share
You can create a mapped drive to the network share on your web server or you can setup impersonation in
web.config. See here.But I suggest you follow the code to impersonate a specific user because it’s a better practice.
Since the resource is not on the same domain as your web server, you’ll need to setup trust between the domains. Here’s a start.