Impersonate in winforms

R

rajeshraju

I am using VB.NET winforms application and want to use impersonation.
This is my app.config file.

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<identity impersonate="true"
userName="userName"
password="password" />

<appSettings>
<add key="LinkLabel1.AutoSize" value="False" />
<add key="MenuItem1.Checked" value="False" />
<add key="mnItemVoid.Checked" value="False" />
<add key="mnItemVoid.Enabled" value="True" />
<add key="mnItemVoid.MergeOrder" value="0" />
<add key="mnItemVoid.Text" value="Void" />
<add key="mnItemVoid.Visible" value="True" />
</appSettings>
</configuration>

I am getting the following error when executing the application

An Unhandled exception of type
"System.Configuration.ConfigurationException" occurred in System.dll.

Additional Information: Unrecognized configuration section identity

I think this is due to the impersonation. Could someone please help me
resolve this.

Thanks
 
N

Norman Yuan

<identity impersonate.../> if for web app's configuration, not for Windows
app.
 
M

mdb

(e-mail address removed) wrote in @f14g2000cwb.googlegroups.com:
Additional Information: Unrecognized configuration section identity

I think this is due to the impersonation. Could someone please help me
resolve this.

As mentioned, this is not supported for windows applications. If you want
a user to be able to run a program as someone else, take a look at the
'runas' program installed on WinXP and Win2k (I think) by default.

-mdb
 
W

Willy Denoyette [MVP]

I am using VB.NET winforms application and want to use impersonation.
This is my app.config file.

<?xml version="1.0" encoding="utf-8"?>
<configuration>

<identity impersonate="true"
userName="userName"
password="password" />

<appSettings>
<add key="LinkLabel1.AutoSize" value="False" />
<add key="MenuItem1.Checked" value="False" />
<add key="mnItemVoid.Checked" value="False" />
<add key="mnItemVoid.Enabled" value="True" />
<add key="mnItemVoid.MergeOrder" value="0" />
<add key="mnItemVoid.Text" value="Void" />
<add key="mnItemVoid.Visible" value="True" />
</appSettings>
</configuration>

I am getting the following error when executing the application

An Unhandled exception of type
"System.Configuration.ConfigurationException" occurred in System.dll.

Additional Information: Unrecognized configuration section identity

I think this is due to the impersonation. Could someone please help me
resolve this.

Thanks

This comes from a web application config file:
<identity impersonate="true"
userName="userName"
password="password" />
and as such it's handled by the web application host, if you need this in
your Winforms application, you have to write code to impersonate just like
the web host (aspnet_wp.exe) is doing.

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top