470,810 Members | 880 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,810 developers. It's quick & easy.

Running a process from ASP.NET

I am trying to spawn a seperate process from my asp page
so when a user clicks the link or button a desktop program
is launched. This will be on an intranet and the program
will exist on the users desktop. I can use the following
code in webmatrix to run a process on my local machine:

<%@ Page Language="VB" %>
<script runat="server">

' Insert page code here
'

Sub Button1_Click(sender As Object, e As EventArgs)
Dim startInfo As System.Diagnostics.ProcessStartInfo
startInfo = New
System.Diagnostics.ProcessStartInfo()
Dim p As System.Diagnostics.Process = New
System.Diagnostics.Process()
startInfo.FileName = "c:\8133324.txt"
startInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
p.Start("c:\winnt\notepad.exe")
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button>
&nbsp;<!-- Insert content here -->
</form>
</body>
</html>
But in .NET Studio running on IIS the process doesn't
spawn. I have tried the following code:

Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Normal
Process.Start(startInfo)

in a button click event, but nothing happens. Any help
would be greatly appreciated.
(Please send VB code, I know C# but this shop uses VB.NET
only)
John
Jul 19 '05 #1
4 9031

John wrote:
|| I am trying to spawn a seperate process from my asp page
|| so when a user clicks the link or button a desktop program
|| is launched. This will be on an intranet and the program
|| will exist on the users desktop. I can use the following
|| code in webmatrix to run a process on my local machine:
||
|| <%@ Page Language="VB" %>
|| <script runat="server">
||
|| ' Insert page code here
|| '
||
|| Sub Button1_Click(sender As Object, e As EventArgs)
|| Dim startInfo As System.Diagnostics.ProcessStartInfo
|| startInfo = New
|| System.Diagnostics.ProcessStartInfo()
|| Dim p As System.Diagnostics.Process = New
|| System.Diagnostics.Process()
|| startInfo.FileName = "c:\8133324.txt"
|| startInfo.WindowStyle =
|| System.Diagnostics.ProcessWindowStyle.Normal
|| p.Start("c:\winnt\notepad.exe")
|| End Sub
||
|| </script>
|| <html>
|| <head>
|| </head>
|| <body>
|| <form runat="server">
|| <asp:Button id="Button1" onclick="Button1_Click"
|| runat="server" Text="Button"></asp:Button>
|| &nbsp;<!-- Insert content here -->
|| </form>
|| </body>
|| </html>
||
||
|| But in .NET Studio running on IIS the process doesn't
|| spawn. I have tried the following code:
||
|| Dim startInfo As New ProcessStartInfo("IExplore.exe")
|| startInfo.WindowStyle = ProcessWindowStyle.Normal
|| Process.Start(startInfo)
||
|| in a button click event, but nothing happens. Any help
|| would be greatly appreciated.
|| (Please send VB code, I know C# but this shop uses VB.NET
|| only)
|| John

This is not possible, IIS, ASP.NET and processes spawned by one of both run in a secured desktop/winstation not the desktop of the
currently logged-on user. So you wont see the "Notepad" window pop-up, but notepad should show up under taskmanager.

Willy.
Jul 19 '05 #2
Do you understand the ASP.NET code is executed on the SERVER?
Steve
"John" <jo****************@l-3com.com> wrote in message
news:02****************************@phx.gbl...
I am trying to spawn a seperate process from my asp page
so when a user clicks the link or button a desktop program
is launched. This will be on an intranet and the program
will exist on the users desktop. I can use the following
code in webmatrix to run a process on my local machine:

<%@ Page Language="VB" %>
<script runat="server">

' Insert page code here
'

Sub Button1_Click(sender As Object, e As EventArgs)
Dim startInfo As System.Diagnostics.ProcessStartInfo
startInfo = New
System.Diagnostics.ProcessStartInfo()
Dim p As System.Diagnostics.Process = New
System.Diagnostics.Process()
startInfo.FileName = "c:\8133324.txt"
startInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
p.Start("c:\winnt\notepad.exe")
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button>
&nbsp;<!-- Insert content here -->
</form>
</body>
</html>
But in .NET Studio running on IIS the process doesn't
spawn. I have tried the following code:

Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Normal
Process.Start(startInfo)

in a button click event, but nothing happens. Any help
would be greatly appreciated.
(Please send VB code, I know C# but this shop uses VB.NET
only)
John

Jul 19 '05 #3
John,

This sounds like a browser security issue. I'm 99.9% sure that spawning
processes on the local machine, via a web page, is turned off as it is a
"BIG" security issue, discussed in many patches that MS has put out over the
last year or so.

Try setting your browser security to low and see if that works.

-Evan

"John" <jo****************@l-3com.com> wrote in message
news:02****************************@phx.gbl...
I am trying to spawn a seperate process from my asp page
so when a user clicks the link or button a desktop program
is launched. This will be on an intranet and the program
will exist on the users desktop. I can use the following
code in webmatrix to run a process on my local machine:

<%@ Page Language="VB" %>
<script runat="server">

' Insert page code here
'

Sub Button1_Click(sender As Object, e As EventArgs)
Dim startInfo As System.Diagnostics.ProcessStartInfo
startInfo = New
System.Diagnostics.ProcessStartInfo()
Dim p As System.Diagnostics.Process = New
System.Diagnostics.Process()
startInfo.FileName = "c:\8133324.txt"
startInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Normal
p.Start("c:\winnt\notepad.exe")
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:Button id="Button1" onclick="Button1_Click"
runat="server" Text="Button"></asp:Button>
&nbsp;<!-- Insert content here -->
</form>
</body>
</html>
But in .NET Studio running on IIS the process doesn't
spawn. I have tried the following code:

Dim startInfo As New ProcessStartInfo("IExplore.exe")
startInfo.WindowStyle = ProcessWindowStyle.Normal
Process.Start(startInfo)

in a button click event, but nothing happens. Any help
would be greatly appreciated.
(Please send VB code, I know C# but this shop uses VB.NET
only)
John

Jul 19 '05 #4
I am having a similar problem with this issue, however my process is starting. The application is not firing though. I am trying to open a pdf file (or even a txt file for that matter) located on the local machine. I have
Process.Start("notepad.exe", @C:\textfile.txt).
Like i said the Process fires, but the application does not. I looked into the browser security settings. Any help is much appreciated.

Phil
Jul 12 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Michael Schmitt | last post: by
3 posts views Thread by Billg_sd | last post: by
4 posts views Thread by sneffe | last post: by
4 posts views Thread by commander_coder | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.