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
|