Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

ClickOnce and login on as a different user

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Anders K. Olsen - 12 Jul 2006 15:56 GMT
Hello group

I'm developing an C# Windows Forms application that I would like to deploy
using ClickOnce.

One of the computers that the application is deployed on, is a computer that
is always loged on as a generic "controlroom" user. This is necessary for
some of the other applications running on the computer.

On my application, the user should always logon as himself or herself.
Therefore I need to present a login form to the user as the first thing.

I have been considering using RunAs, but I'm not sure that is possible along
with ClickOnce, at least nok using the GUI of RunAs.

I have looked at the Windows API LogonUser, but that seems to be requiring
unsafe code permissions and FullTrust, and I was hoping that I could avoid
giving those permissions to the application, especially when I'm deploying
it using ClickOnce.

Do you have any alternative suggestions?

Thank you for your answer.

Regards
Anders Olsen
Steve B. - 12 Jul 2006 16:35 GMT
Do you really need authenticate against local computer ?
If your application will use a remote server (Web service, DB or anything),
you can try to authenticate against this service to check if the user can
access to the application...

Steve

> Hello group
>
[quoted text clipped - 22 lines]
> Regards
> Anders Olsen
Anders K. Olsen - 13 Jul 2006 07:45 GMT
> Do you really need authenticate against local computer ?
> If your application will use a remote server (Web service, DB or
> anything), you can try to authenticate against this service to check if
> the user can access to the application...

Hello Steve

Thank you for your answer.

I have been thinking about this. My application will have a server, and I
could do the authentication on the server. However, I would like to run my
client application as the correct user, so I would like to impersonate this
user even though the actual windows user is the "controlroom" user.

My reason for this is that I would like to call my web service methods as
the correct windows user, and use Windows build in authentication and
authorization on both the server and the client.

I don't know that much about impersonation, so I don't know if this is even
possible. My idea was that the first thing that happends is that the user is
authenticated and then the I would set Thread.CurrentPrincipal to a
WindowsPrincipal corresponding to the correct user (not the "controlroom"
user). It was my hope that the rest of the application would then run as the
correct user. I'm not sure if this is correct, e.g. if new threads will also
run as the correct user, or if threadpool threads will also run as the
correct user.

Regards
Anders
Robbe Morris [C# MVP] - 16 Jul 2006 02:11 GMT
Forcing your server to be apart of the same active directory
domain (your users would be authenticated against their
windows accounts)?

Are you sure that is a good long term configuration?

What happens when the system admin folks want
to isolate your production servers from windows
account holders altogether?

Signature

Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

>> Do you really need authenticate against local computer ?
>> If your application will use a remote server (Web service, DB or
[quoted text clipped - 25 lines]
> Regards
> Anders

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.