Click here to Skip to main content
12,952,181 members (57,570 online)
Rate this:
Please Sign up or sign in to vote.
I have been working on this problem for a week:

I have a class library that hosts a .net webbrowser control. This webbrowser control kicks off a vbscript which uses RDS technology to communicate with a database. Everthing works fine if I change my internet options to 'allow datasources accross domains'. However, this is not an option when deployment happens due to obvious security concerns. The problem then is getting the solution to work WITHOUT changing the global ie settings.

Things I have tried: *Adding the site that we access via RDS to our 'trusted sites' (didn't make a difference) *Researched the custom security manager for the webbrowser control *To find any other way to make this work besides the custom security manager since documentation seems lacking and it is tricky to implement

Where I need help: The custom security manager seems to be the way to go but I am having to pull from multiple posts and there seem to be gaps in how to implement it with c# in the .net framework. I am having some trouble getthing started here. I think if I had some footing of namespaces and project references that I might be able to use some other posts I have found which seem to provide the coding portion of the IInternetSecurityManager. There seems to be a need to override a base class, then inherit that from another base class, but I am having trouble there. So I need helping getting started if possible, and then be able to ask questions along the way after I get going.

What I would like to understand It seems the webbrowser control is not safe for scripting, so that it doesn't EXACTLY mimic IE. I wonder if there is a way to up the permissions on my class library, or register it, or give more permissions to the webbrowser control without having to implement the custom security manager?

Posted 9-Oct-12 3:48am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Well, this isnt a solution to the above problem but a work around. I found a way to bring the RDS into and got that working successfully. Here is an example for othes who may be struggling:

Function getEncryptedPassword(password, hostName)
    On Error Resume Next
    Dim objDS, encryptedPassword
    Set objDS = CreateObject("RDS.DataSpace")
    Set CTX = objDS.CreateObject("myServer","myHost")
    Set objDS = Nothing
    encryptedPassword = CTX.EncryptString(1234567, password)
    If encryptedPassword = "" Then
        getEncryptedPassword = "nothing"
        getEncryptedPassword = encryptedPassword
    End If
End Function

translated to (must add reference to Microsoft Remote Data Services Library, then "Imports RDS"):
Private Function getEncryptedPasswordRDS() As Boolean
   Dim objRDS As DataSpace = New DataSpace()
   Dim objCLS = objRDS.CreateObject("myServer","myHost")
   Dim encryptedPassword = objCLS.EncryptString(1234567, Me.password)
   If encryptedPassword = String.Empty Then           
       Return False
       Return True
   End If
End Function

----- TO TRANSLATE RECORDSETS -----------------------
Function getIdToSubmit(invoiceId_producer,sessionId, dbId, hostName, customerId)
    On Error Resume Next
    Dim ObjDS, SQLStmnt, rs, ErrorText, RecordCount
    Set objDS = CreateObject("RDS.DataSpace")
    Set CTX = objDS.CreateObject("myServer","myHost" )
    Set objDS = Nothing
    SQLStmnt = "SELECT something1, something2 from someTable"
    Set rs = CTX.OpenRecordset(SQLStmnt, 3, 1, 0,sessionId, dbId, ErrorText)
           If rs.RecordCount > 0 Then
            Dim errormsg
            If errormsg="" Then
                getIdToSubmit = CStr(rs("something2"))
                getIdToSubmit = Cstr(rs("something1"))
            End If
            getInvoiceIdToSubmit="There were no records returned."
        End If
End Function translation:
Private Function getIdToSubmit()
Dim objRDS As DataSpace = New DataSpace()
Dim objCLS = objRDS.CreateObject("myServer", "myHost")
Dim sqlStatement As String = "SELECT something1, something2 from someTable"
Dim rs = objCLS.OpenRecordset(sqlStatement, 3, 1, 0, _sessionId, dbId, ErrorText)
If rs.RecordCount > 0 Then
Dim errormsg
errormsg = rs.Fields("something1").Value.ToString()
If errormsg = "" Then
_myPrivateVariable= rs.Fields("something2").Value.ToString()
 _myPrivateVariable = rs.Fields("something1").Value.ToString()
End If
_myPrivateVariable="no records returned"
End If
Marcus Kramer 9-Oct-12 17:39pm
Thanks for providing the solution. +5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,239
CHill60 3,490
Maciej Los 3,083
Jochen Arndt 1,975
ppolymorphe 1,880

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 9 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100