Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Please find code below which is run by an Excel macro. I am trying to make this call a Webservice I wrote in another C# solution.

 

When the code trys to run this method, it gives the error "Execution permission cannot be acquired". Even the MsgBox At the Top does not appear. However, if I comment the line token = new usernameToken(..., The MsgBox Came to the End will appear.

 

Does anyone know what is the problem.

 

Thanks

Guha

PS. This application

Imports Office = Microsoft.Office.Core (Microsoft Office 11.0 Object Library)

Imports Excel = Microsoft.Office.Interop.Excel (Microsoft Excel 11.0 Object Library)

<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>

Public Sub PostToSwims(ByVal publisherName As String, _

ByVal vendorName As String, _

ByVal programName As String, _

ByVal effectiveDate As String, _

ByVal jobDesc As String, _

ByVal fileName As String)

MsgBox("At the top")

Dim strResult As String

Dim token As UsernameToken

Dim username As String = "BLAHBLAH"

Dim passwordBytes() As Byte = System.Text.Encoding.UTF8.GetBytes("BSBSBS")

Array.Reverse(passwordBytes)

Dim passwordEquivalent As String

 

passwordEquivalent = Convert.ToBase64String(passwordBytes)

token = Nothing

 

Try

token = New UsernameToken(username, passwordEquivalent, PasswordOption.SendPlainText)

Catch ex As Exception

MsgBox(ex.Message)

End Try

 

MsgBox("Came to the End")

 

End Sub

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...