0

In our ASP.NET application, we need to programmatically access (read/Write) a shared location that is not on our domain. I am currently using WNetUseConnection as suggested here.

But it looks like that I need to call this win32 API every time I have to read or write to this shared location.

Is there something that I'm missing or anything better you can suggest?

Community
  • 1
  • 1
Faisal
  • 4,054
  • 6
  • 34
  • 55

1 Answers1

3

No, that's the way you must do it, unless you keep an impersonated thread. But that would be a waste of resources.

jgauffin
  • 99,844
  • 45
  • 235
  • 372
  • are you suggesting me to call WNetUseConnection API on every read/write call? If so, what is the performance impact you see with this? – Faisal May 16 '11 at 05:50
  • Do not care about performance unless you are sure that `WNetUseConnection` is the largest performance thief. – jgauffin May 16 '11 at 06:41