Connecting Tech Pros Worldwide Forums | Help | Site Map

Starting desktop application from asp.net web app on IIS

Newbie
 
Join Date: Sep 2006
Posts: 1
#1: Sep 20 '06
Hi All, I am new to ASP/VB .NET - I wrote a code for running desktop applications for buttons. It works fine on my local machine, it doesn't work on the webserver. I am using SQL authentication.

Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click
Dim strSID As String = Session.SessionID
Dim ConnectionString As String = Session("sessConn")
SqlDataSource1.ConnectionString = Session("sessConn")
SqlDataSource2.ConnectionString = Session("sessConn")
svr_machine_model.ConnectionString = Session("sessConn")
svr_location.ConnectionString = Session("sessConn")
svr_calling_station.ConnectionString = Session("sessConn")
svr_corporate_build.ConnectionString = Session("sessConn")
svr_machine_type.ConnectionString = Session("sessConn")
svr_OS.ConnectionString = Session("sessConn")
svr_service_pack.ConnectionString = Session("sessConn")

If DropDownList3.Items.Count = 0 Then
'MsgBox("No Server Selected!", MsgBoxStyle.Exclamation)
Return
End If

Dim Param As String = ""

Dim ctrl2 As Control = FormView1.FindControl("Remote_Acc_IPLabel")
Dim RemoteAccessIPLabel As Label = ctrl2
Param = RemoteAccessIPLabel.Text

Dim command As String = "http://" + Param
If Param <> "" Then
System.Diagnostics.Process.Start(command)
Else
End If

End Sub


The above code gives the following error on webserver.
Exception Details: System.ComponentModel.Win32Exception: Access is denied

Line 370: System.Diagnostics.Process.Start(command, args)


And a similar code for another button gives a diff. error:
Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click

Dim strSID As String = Session.SessionID
Dim ConnectionString As String = Session("sessConn")
SqlDataSource1.ConnectionString = Session("sessConn")
SqlDataSource2.ConnectionString = Session("sessConn")
svr_machine_model.ConnectionString = Session("sessConn")
svr_location.ConnectionString = Session("sessConn")
svr_calling_station.ConnectionString = Session("sessConn")
svr_corporate_build.ConnectionString = Session("sessConn")
svr_machine_type.ConnectionString = Session("sessConn")
svr_OS.ConnectionString = Session("sessConn")
svr_service_pack.ConnectionString = Session("sessConn")

If DropDownList3.Items.Count = 0 Then
'MsgBox("No Server Selected!", MsgBoxStyle.Exclamation)
Return
End If

Dim Param As String = ""

Dim command As String = "mstsc"

Dim ctrl2 As Control = FormView1.FindControl("IPAddressLabel")
Dim IPAddressLabel As Label = ctrl2
Param = IPAddressLabel.Text

Dim args As String = "/v:" + Param
If Param <> "" Then
'MsgBox("Please wait while trying to connect...", MsgBoxStyle.MsgBoxRight, "Connecting")
System.Diagnostics.Process.Start(command, args)
Else
'MsgBox("IP Address field empty!!! Please enter a valid IP Address in the Server Details Card.", MsgBoxStyle.Exclamation, "Error!!!")
End If
End Sub

Gives the following EXCEPTION:
Exception Details: System.ComponentModel.Win32Exception: The system cannot find the file specified


Also, kindly let me know how to pop-up msgs on IIS/webserver.

Hijabi
radcaesar's Avatar
Moderator
 
Join Date: Sep 2006
Posts: 756
#2: Sep 21 '06

re: Starting desktop application from asp.net web app on IIS


For the system cannot find the file specified exception
Check with the fire path. you have to mention the Full file path and name as the Parameter.

For the Access denied exception,

Goto .Net framework configuration permission set to ' Full
Access' on the Runtime Security Policy --> Machine --> Code Groups -->
All_Code --> Internet Zone.

By default, the "security" permission set that
is applied to the internet zone does not allow calls to unmanaged code.

Then Check impersonated user or group has access to the particular
files and directories.
Reply