connect to website through proxy in vb.net script in SSIS
I am trying to write an SSIS package that connect to an XML feed to download FX rates and import them into an SQL table.
i have the code below, but cannot figure out how to implement logging in through a proxy.
if anyone can think of an easier way to do the above, i'm more than willing to give it a try.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Xml
Imports System.Net
Public Class ScriptMain
Public Sub Main()
Dim xmlDoc As XmlDataDocument, strXML As String
Dim client As System.Net.WebClient = New System.Net.WebClient()
Dim cr As New System.Net.NetworkCredential("user", "password")
Dim pr As New System.Net.WebProxy("proxy", 8080)
pr.Credentials = cr
client.Proxy = pr
xmlDoc = New XmlDataDocument
xmlDoc.Load("http://themoneyconverter.com/GBP/rss.xml")
strXML = CType(xmlDoc.InnerXml, String)
Dts.Variables("strXMLData").Value = strXML
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
Many thanks.
xml vb.net sql-server-2005 ssis
add a comment |
I am trying to write an SSIS package that connect to an XML feed to download FX rates and import them into an SQL table.
i have the code below, but cannot figure out how to implement logging in through a proxy.
if anyone can think of an easier way to do the above, i'm more than willing to give it a try.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Xml
Imports System.Net
Public Class ScriptMain
Public Sub Main()
Dim xmlDoc As XmlDataDocument, strXML As String
Dim client As System.Net.WebClient = New System.Net.WebClient()
Dim cr As New System.Net.NetworkCredential("user", "password")
Dim pr As New System.Net.WebProxy("proxy", 8080)
pr.Credentials = cr
client.Proxy = pr
xmlDoc = New XmlDataDocument
xmlDoc.Load("http://themoneyconverter.com/GBP/rss.xml")
strXML = CType(xmlDoc.InnerXml, String)
Dts.Variables("strXMLData").Value = strXML
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
Many thanks.
xml vb.net sql-server-2005 ssis
So you're saying the code works, but you're interested in implementing logging?
– p.campbell
Jul 6 '11 at 13:35
no, i'm interested in logging into the corporate proxy so i can access the xml file and download it into SSIS and on to the SQL server
– Adam McC
Jul 6 '11 at 13:49
add a comment |
I am trying to write an SSIS package that connect to an XML feed to download FX rates and import them into an SQL table.
i have the code below, but cannot figure out how to implement logging in through a proxy.
if anyone can think of an easier way to do the above, i'm more than willing to give it a try.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Xml
Imports System.Net
Public Class ScriptMain
Public Sub Main()
Dim xmlDoc As XmlDataDocument, strXML As String
Dim client As System.Net.WebClient = New System.Net.WebClient()
Dim cr As New System.Net.NetworkCredential("user", "password")
Dim pr As New System.Net.WebProxy("proxy", 8080)
pr.Credentials = cr
client.Proxy = pr
xmlDoc = New XmlDataDocument
xmlDoc.Load("http://themoneyconverter.com/GBP/rss.xml")
strXML = CType(xmlDoc.InnerXml, String)
Dts.Variables("strXMLData").Value = strXML
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
Many thanks.
xml vb.net sql-server-2005 ssis
I am trying to write an SSIS package that connect to an XML feed to download FX rates and import them into an SQL table.
i have the code below, but cannot figure out how to implement logging in through a proxy.
if anyone can think of an easier way to do the above, i'm more than willing to give it a try.
Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Xml
Imports System.Net
Public Class ScriptMain
Public Sub Main()
Dim xmlDoc As XmlDataDocument, strXML As String
Dim client As System.Net.WebClient = New System.Net.WebClient()
Dim cr As New System.Net.NetworkCredential("user", "password")
Dim pr As New System.Net.WebProxy("proxy", 8080)
pr.Credentials = cr
client.Proxy = pr
xmlDoc = New XmlDataDocument
xmlDoc.Load("http://themoneyconverter.com/GBP/rss.xml")
strXML = CType(xmlDoc.InnerXml, String)
Dts.Variables("strXMLData").Value = strXML
Dts.TaskResult = Dts.Results.Success
End Sub
End Class
Many thanks.
xml vb.net sql-server-2005 ssis
xml vb.net sql-server-2005 ssis
asked Jul 6 '11 at 13:17
Adam McCAdam McC
123318
123318
So you're saying the code works, but you're interested in implementing logging?
– p.campbell
Jul 6 '11 at 13:35
no, i'm interested in logging into the corporate proxy so i can access the xml file and download it into SSIS and on to the SQL server
– Adam McC
Jul 6 '11 at 13:49
add a comment |
So you're saying the code works, but you're interested in implementing logging?
– p.campbell
Jul 6 '11 at 13:35
no, i'm interested in logging into the corporate proxy so i can access the xml file and download it into SSIS and on to the SQL server
– Adam McC
Jul 6 '11 at 13:49
So you're saying the code works, but you're interested in implementing logging?
– p.campbell
Jul 6 '11 at 13:35
So you're saying the code works, but you're interested in implementing logging?
– p.campbell
Jul 6 '11 at 13:35
no, i'm interested in logging into the corporate proxy so i can access the xml file and download it into SSIS and on to the SQL server
– Adam McC
Jul 6 '11 at 13:49
no, i'm interested in logging into the corporate proxy so i can access the xml file and download it into SSIS and on to the SQL server
– Adam McC
Jul 6 '11 at 13:49
add a comment |
2 Answers
2
active
oldest
votes
You can use the credentials of the currrent login with:
Imports System.Net
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
' WebRequest.DefaultWebProxy is the proxy settings used by xml.Load()
add a comment |
Worked perfectly in SSIS 2012 - thanks
Aside from the Imports System.Net in the declaration, my final code looked like this :
Dim Proxy As String, Port As Integer
Proxy = "EnterYourProxyServerName"
Port = TypeInYourProxyPortAsANumber
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
Dts.TaskResult = ScriptResults.Success
Obviously this is a client side proxy hack.
Haven't tried this on the server yet.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f6597025%2fconnect-to-website-through-proxy-in-vb-net-script-in-ssis%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can use the credentials of the currrent login with:
Imports System.Net
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
' WebRequest.DefaultWebProxy is the proxy settings used by xml.Load()
add a comment |
You can use the credentials of the currrent login with:
Imports System.Net
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
' WebRequest.DefaultWebProxy is the proxy settings used by xml.Load()
add a comment |
You can use the credentials of the currrent login with:
Imports System.Net
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
' WebRequest.DefaultWebProxy is the proxy settings used by xml.Load()
You can use the credentials of the currrent login with:
Imports System.Net
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
' WebRequest.DefaultWebProxy is the proxy settings used by xml.Load()
edited Jun 11 '12 at 10:28
answered Jun 11 '12 at 9:09
StephenStephen
112
112
add a comment |
add a comment |
Worked perfectly in SSIS 2012 - thanks
Aside from the Imports System.Net in the declaration, my final code looked like this :
Dim Proxy As String, Port As Integer
Proxy = "EnterYourProxyServerName"
Port = TypeInYourProxyPortAsANumber
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
Dts.TaskResult = ScriptResults.Success
Obviously this is a client side proxy hack.
Haven't tried this on the server yet.
add a comment |
Worked perfectly in SSIS 2012 - thanks
Aside from the Imports System.Net in the declaration, my final code looked like this :
Dim Proxy As String, Port As Integer
Proxy = "EnterYourProxyServerName"
Port = TypeInYourProxyPortAsANumber
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
Dts.TaskResult = ScriptResults.Success
Obviously this is a client side proxy hack.
Haven't tried this on the server yet.
add a comment |
Worked perfectly in SSIS 2012 - thanks
Aside from the Imports System.Net in the declaration, my final code looked like this :
Dim Proxy As String, Port As Integer
Proxy = "EnterYourProxyServerName"
Port = TypeInYourProxyPortAsANumber
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
Dts.TaskResult = ScriptResults.Success
Obviously this is a client side proxy hack.
Haven't tried this on the server yet.
Worked perfectly in SSIS 2012 - thanks
Aside from the Imports System.Net in the declaration, my final code looked like this :
Dim Proxy As String, Port As Integer
Proxy = "EnterYourProxyServerName"
Port = TypeInYourProxyPortAsANumber
Dim Pr As New System.Net.WebProxy(Proxy, Port)
Pr.Credentials = System.Net.CredentialCache.DefaultCredentials
WebRequest.DefaultWebProxy = Pr
Dts.TaskResult = ScriptResults.Success
Obviously this is a client side proxy hack.
Haven't tried this on the server yet.
edited Nov 12 '18 at 20:28
Vickel
3,37542243
3,37542243
answered Nov 12 '18 at 20:00
rascasse83rascasse83
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f6597025%2fconnect-to-website-through-proxy-in-vb-net-script-in-ssis%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
So you're saying the code works, but you're interested in implementing logging?
– p.campbell
Jul 6 '11 at 13:35
no, i'm interested in logging into the corporate proxy so i can access the xml file and download it into SSIS and on to the SQL server
– Adam McC
Jul 6 '11 at 13:49