<p>When connecting to a network share for which the current user (in my case, a network enabled service user) has no rights, name and password have to be provided.</p>

<p>I know how to do this with Win32 functions (the <code>WNet*</code> family from <code>mpr.dll</code>), but would like to do it with .Net (2.0) functionality.</p>

<p>What options are available?</p>

<p><strong>Maybe some more information helps:</strong></p>

<ul>
<li>The use case is a windows service, not an Asp.Net application.</li>
<li>The service is running under an account which has no rights on the share.</li>
<li>The user account needed for the share is not known on the client side.</li>
<li>Client and server are not members of the same domain.</li>
</ul>

You should be looking at adding a line like this:
```
```
<identity impersonate="true" userName="domain\user" password="****" />
```
```
Into your web.config.
More Information.