473,387 Members | 1,624 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

ASP.Net - Run external application as specific user

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!
Nov 20 '05 #1
6 1726
Hi Greg,

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

Regards,
Fergus
Nov 20 '05 #2
Cor
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
Nov 20 '05 #3
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" <fi******@tesco.net> wrote in message news:<O1**************@TK2MSFTNGP10.phx.gbl>...
Hi Greg,

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

Regards,
Fergus

Nov 20 '05 #4
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
Nov 20 '05 #5
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" <fi******@tesco.net> wrote in message news:<e1*************@TK2MSFTNGP10.phx.gbl>...
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

Nov 20 '05 #6
Way to go, Greg! ;-) Thanks for the link - I'll go learn myself something.
Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Kathy Benson | last post by:
Hi, I need to open an external file, such as *.htm from a Java program. I need to open this file by the default program that handles this extension on the machine. So *.htm should always be opened...
1
by: Aged | last post by:
Hi I have asked several groups now for advise but I feel I must be confusing either them or myself, but anyway here goes! Below is code taken from the "OnClick" function of a command button...
5
by: snicks | last post by:
I'm trying to exec a program external to my ASP.NET app using the following code. The external app is a VB.NET application. Dim sPPTOut As String sPPTOut = MDEPDirStr + sID + ".ppt" Dim p As...
2
by: Lonifasiko | last post by:
Hi group, I must launch from my Winforms application another application (.exe developed by the client) which response time sometimes can be more or less 30 seconds. I'm using ProcessManager...
3
by: Big Charles | last post by:
Hi, We have developed an ASP.NET web application and are planning to host it in an external Server, which provides us a good bandwidht. We need to put he web application outside because the...
2
by: =?Utf-8?B?SXJmYW4=?= | last post by:
Hello, It may be a repeated question but I don't find the solution to the situation that I encounter in it. My application is monitoring another application that is built in VB6. The...
5
by: Ian | last post by:
I am trying to: 1. Open a form on the external database 2. Enter a value in a text box on that form I have 1 above working OK using module form “The Access Web”, the module looks like this: ...
0
debasisdas
by: debasisdas | last post by:
This thread contains some useful tips for using External tables. USING EXTERNAL TABLE ======================= 1.THE TABLE POINTS TO EXTERNAL FILE. IF DATA IS ALTERED IN THE EXTERNAL FILE,DATA...
3
by: Andy B | last post by:
I have a web form that has controls to be modified on it. The class that will modify the controls is not contained inside the page code. How would I best pass the controls to the external class?
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.