Trying to Auto Deploy Windows App (No Luck!)

I

Ian

I am using a call application that has a button with the
following code to have the windows application sitting on
the web server come up.

Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim formAsm As [Assembly] = [Assembly].LoadFrom
("http://SERVER/Cusip/CusipWindows.exe")
Dim formtype As Type = formAsm.GetType
("CusipChangeWindows.Form1")

Dim FormObj As Object
FormObj = Activator.CreateInstance(formtype)
Dim Form1 As Form = CType(FormObj, Form)
Form1.Show()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

When I press the button I get an error on the
CreateInstance line ("Exception has been thrown by the
target of an invocation"). Listed below is the code from
the windows application. I setup the application under
the inetpub/wwwroot folder and gave it script only
executable permission and I put the data layer dll in the
GAC with a strong name. I also setup the server as a
trusted site on my machine and changed the security
policy for trusetd sites to meduim using the .NET wizard.
I don't know what else to try to get this application to
run. I also ran the application right from the browser
without the intermediary application and I got this
error:

"An unhandled exception of
type 'System.Security.SecurityException' occurred in
IEExec.exe

Additional information: Request for the permission of
type System.Security.Permissions.SecurityPermission,
mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089 failed."

Code:
*****************************************************
Imports Microsoft.ApplicationBlocks.Data
Imports System.Security.Principal.WindowsIdentity
Imports System.Configuration

Public Class Form1
Inherits System.Windows.Forms.Form
Private dsCusip As New DataSet
Private CusipTable As New DataTable
Private iChange As Byte
Private MyString As String = GetCurrent.Name() 'Gets the
windows user
Private User As String = MyString.Remove(1, 11)
Private configFile As String = Application.ExecutablePath
& ".config"
Private strConnection As String

Private Function SaveNewChange(ByVal OrigCusip As String,
ByVal NewCusip As String, ByVal effdt As Date, ByVal
Commnt As String) As Boolean
Try
' Set up parameters (4 input)
Dim arParms() As SqlClient.SqlParameter = New
SqlClient.SqlParameter(4) {}
arParms(0) = New SqlClient.SqlParameter("@OrigCusip",
SqlDbType.Char, 15)
arParms(0).Value = OrigCusip
arParms(1) = New SqlClient.SqlParameter("@NewCusip",
SqlDbType.Char, 15)
arParms(1).Value = NewCusip
arParms(2) = New SqlClient.SqlParameter("@EffDate",
SqlDbType.DateTime)
arParms(2).Value = effdt
arParms(3) = New SqlClient.SqlParameter("@user",
SqlDbType.VarChar, 15)
arParms(3).Value = User
arParms(4) = New SqlClient.SqlParameter("@Comments",
SqlDbType.VarChar, 2000)
arParms(4).Value = Commnt

Dim Reader = SqlHelper.ExecuteReader(strConnection,
CommandType.StoredProcedure, "Cusip_CusipChangeSave",
arParms)

While Reader.Read
MsgBox(Reader.Item("Status"))
End While

'set the changed flag
iChange = 0
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function

Private Sub btnSave_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnSave.Click
If txtOrigCusip.Text <> "" And txtNewCusip.Text <> ""
Then
SaveNewChange(txtOrigCusip.Text, txtNewCusip.Text,
dtEffDate.Value, txtComments.Text)
End If
End Sub

Public Sub getChanges()
Dim connection As SqlClient.SqlConnection = Nothing

If iChange = 0 Then
Try
connection = GetConnection(strConnection)
Catch ex As Exception
MessageBox.Show("The connection with the database can´t
be established", "Application Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try

Try
SqlHelper.FillDataset(connection,
CommandType.StoredProcedure, "Cusip_PamCusipChanges",
dsCusip, New String() {"Cusips"})
CusipTable = dsCusip.Tables("Cusips")
DataGrid1.DataSource = dsCusip.Tables("Cusips")

'set the changed flag
iChange = 1
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub

Private Sub TabControl1_Click(ByVal sender As Object,
ByVal e As System.EventArgs) Handles TabControl1.Click
Dim i As Int32 = TabControl1.SelectedIndex
If i = 1 Then
getChanges()
End If
End Sub

Private Sub btnDelete_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnDelete.Click
Dim connection As SqlClient.SqlConnection = Nothing
Dim ErrorMsg As String

Try
connection = GetConnection(strConnection)
Catch ex As Exception
MessageBox.Show("The connection with the database can´t
be established", "Application Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End Try

'Create the command that will be used for insert
operations
Dim insertCommand As SqlClient.SqlCommand =
SqlHelper.CreateCommand
(connection, "Cusip_CusipChangeSave", "OrigCusip", "NewCus
ip", "EffDate", "User", "Comments")

'Create the command that will be used for update
operations
Dim updateCommand As SqlClient.SqlCommand =
SqlHelper.CreateCommand
(connection, "Cusip_UpdateCusipChanges", "ID")

'Create the command that will be used for delete
operations
Dim deleteCommand As SqlClient.SqlCommand =
SqlHelper.CreateCommand
(connection, "Cusip_DeleteSingleCusip", "ID")

Try
'Update the data source with the DataSet changes
SqlHelper.UpdateDataset(insertCommand, deleteCommand,
updateCommand, dsCusip, "Cusips")

MsgBox("Data Saved")
Catch ex As Exception
MsgBox(ex.Message)
Catch concurrencyException As DBConcurrencyException
MessageBox.Show("A concurrency error has ocurred while
trying to update the data source", "Application Error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
ErrorMsg = "The following rows weren´t updated: "
Dim currentRow As DataRow
For Each currentRow In CusipTable.Rows
If currentRow.RowState <> DataRowState.Unchanged Then
ErrorMsg += Environment.NewLine & "Product ID: " &
currentRow("ProductID").ToString() & _
" Product Name: " & currentRow("ProductName").ToString()
End If
MsgBox(ErrorMsg)
Next
Finally
'set the changed flag
iChange = 0
End Try
End Sub

Private Sub CreateReport(ByVal QueryType As String)
MsgBox(strConnection)
End Sub

Private Function GetConnection(ByVal connectionString As
String) As SqlClient.SqlConnection
Dim connection As New SqlClient.SqlConnection
(connectionString)

connection.Open()

Return connection
End Function


Private Sub Form1_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Load
strConnection = ConfigurationSettings.AppSettings.Get
("ConnectionString")
End Sub
End Class
**********************************************************
****************
 
D

Duke Sun

I'm now performing research on the issue. I will update you as soon as
possible.
Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
 
D

Duke Sun

I'm still performing research on the issue. I will update you as soon as
possible.

Best regards,

Duke Sun
Microsoft Online Partner Support
<MCSE/MCDBA/MCSD>

Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
I

Ian

I did exactly what was given for instructions and I still receive the
following error

An unhandled exception of type 'System.Security.SecurityException' occurred
in IEExec.exe

Additional information: Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
 
I

Ian

I figured out the problem.

thanks

Ian said:
I did exactly what was given for instructions and I still receive the
following error

An unhandled exception of type 'System.Security.SecurityException' occurred
in IEExec.exe

Additional information: Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top