PC Review


Reply
Thread Tools Rating: Thread Rating: 5 votes, 1.80 average.

ASP.Net - Run external application as specific user

 
 
Greg
Guest
Posts: n/a
 
      8th Oct 2003
Here's the situation.

I have an asp.net application that calls a console application which
copies files between servers. I have the console application because
the copying of files takes a while and don't want the asp.net app to
wait until its finished. So the user clicks on a button within the
asp.net app and I'm using the Shell command to call the console app.

I've tried using impersonate within the asp.net application but it
looses the info when the console application is called. If I run the
console app but its self, away from the asp.net app, it runs fine
which leads me to believe the console app is running under the aspnet
userid which doesn't have access to the servers.

Questions
1. Is there a way to run the console application as a different user?
2. Can I connect to a UNC in the console application as a specific
user preferrable without mapping a drive?

Any help is greatly appreciated.

Thanks!
 
Reply With Quote
 
 
 
 
Fergus Cooney
Guest
Posts: n/a
 
      8th Oct 2003
Hi Greg,

Would doing your file transfer in a separate Thread but still within your
asp.net app be of any use?

Regards,
Fergus


 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      9th Oct 2003
Greg,
I think that this needs a windows service.

Although it sounds strange, it sounds as an unmanaged proces, what happens
by instance when the user send twice?
But that is your problem of course.

Giving the control over to another user than the asp.user will give I think
(when you get it working with another user) maybe problems again in future
because of a "maybe" security patch from Microsoft.
Just a thougth
Cor


 
Reply With Quote
 
Greg
Guest
Posts: n/a
 
      9th Oct 2003
Fergus,

I've never used threads before but from looking at it today, it seems
to be the good choice. But I still can't get it working. Here is the
code I'm using.

Dim myThread As New System.Threading.Thread(AddressOf Transfer)
myThread.Start()

The process still doesn't have access to the servers. But if I call
Transfer directly without going thru the new thread, it works. So it
still appears the new thread isn't using the impersonate user.

Hopefully there is a way to set the user for the thread but I haven't
found it yet. Any ideas?



"Fergus Cooney" <filter-(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Hi Greg,
>
> Would doing your file transfer in a separate Thread but still within your
> asp.net app be of any use?
>
> Regards,
> Fergus

 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      10th Oct 2003
Hi Greg,

I'm afraid I've done nothing in the way of users and impersonation (I only
have a vague idea what this actually means).

You're saying that the impersonation works in the App but not in a new
Thread? This surprises me as my understanding is that Threads are supposed to
share whatever else is going on within the AppDomain. However, my knowledge
<is> scanty.

I wish I could help further. :-(

Regards,
Fergus


 
Reply With Quote
 
Greg
Guest
Posts: n/a
 
      10th Oct 2003
I finally got it. Using the link below, I added the impersonation
code as part of my procedure which is called by the thread.

http://support.microsoft.com/default...;en-us;Q306158

Thanks for you help.


"Fergus Cooney" <filter-(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> Hi Greg,
>
> I'm afraid I've done nothing in the way of users and impersonation (I only
> have a vague idea what this actually means).
>
> You're saying that the impersonation works in the App but not in a new
> Thread? This surprises me as my understanding is that Threads are supposed to
> share whatever else is going on within the AppDomain. However, my knowledge
> <is> scanty.
>
> I wish I could help further. :-(
>
> Regards,
> Fergus

 
Reply With Quote
 
Fergus Cooney
Guest
Posts: n/a
 
      10th Oct 2003
Way to go, Greg! ;-) Thanks for the link - I'll go learn myself something.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
including user-specific information without recompiling application BillE Microsoft VB .NET 1 31st Mar 2009 05:29 PM
Interesting flickering problem if application's user control is invalidated by external application (e.g. Notepad) sasifiqbal@gmail.com Microsoft C# .NET 2 27th Apr 2006 05:58 PM
How to allow normal user install a specific application Jake Smythe Windows XP Security 0 18th Aug 2005 02:50 PM
Forcing a specific machine to map to a specific external IP Henry Stock Microsoft Windows 2000 RAS Routing 0 4th Dec 2003 10:52 PM
Rookie: How to run application with specific user account? Dave Guenthner Microsoft C# .NET 1 22nd Sep 2003 11:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:32 PM.