Sky Software Homepage LogicNP Software Knowledge Base And FAQ

 
Contact Product Support    SearchSearch      Subscribe to the RSS feed for this forum

HOWTO: Specify credentials and proxy settings when communicating with the license service

 
Subscribe to the RSS feed for this forum  Forum Index -> CryptoLicensing For .Net
View previous topic :: View next topic  
Author Message
Support



Joined: 18 Jul 2005
Posts: 731

Posted: Tue Sep 15, 2009 3:46 am    Post subject: HOWTO: Specify credentials and proxy settings when communicating with the license service

To specify credentials and proxy settings when communicating with the license service, handle the OnInitWebRequest event as follows (NOTE: In older versions of CryptoLicensing (build 150317 or earlier), you will need to derive your own class from CryptoLicense and override the InitWebRequest method):

[C#]
Code:


// Validating a license...

CryptoLicense lic = new CryptoLicense();

lic.ValidationKey = "<<validation key for your project>>";
lic.LicenseCode = "<<License code with custom machine code embedded>>";

            lic.OnInitWebRequest += (o, e) => {
                // Use this proxy for all communication with the license service
                System.Net.WebProxy proxyObject = new System.Net.WebProxy("http://proxyserver:80/", true);
                e.Request.Proxy = proxyObject;
            };

// Validate license
MessageBox.Show(lic.Status.ToString());


[VB.Net]
Code:


' Validating a license...

Dim lic As CryptoLicense = New CryptoLicense()

lic.ValidationKey = "<<validation key for your project>>"
lic.LicenseCode = "<<License code with custom machine code embedded>>"

        AddHandler lic.OnInitWebRequest,
Sub(o As Object, args As InitWebRequestEventArgs)
    ' Use this proxy for all communication with the license service
    Dim proxyObject As System.Net.WebProxy = New System.Net.WebProxy("http://proxyserver:80/", True)
    args.Request.Proxy = proxyObject
End Sub

' Validate license
MessageBox.Show(lic.Status.ToString())
Back to top
Display posts from previous:   
Forum Index -> CryptoLicensing For .Net All times are GMT
Page 1 of 1

 
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group