question

Terri avatar image
Terri asked

Connect to url and the redirecting to another url in SSIS 2005

I need to connect to a website, login and then redirect to another url and download a file. I can successfully connect/log to the first page but I don't know how to redirect to another url. I'm using a script task in Visual Studion 2005. I've tried using HTTPRequest and WebcClient. Any suggestions?
.net
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Redirect is something that the web server would do, not the client (your SSIS package). Have you tried DownloadFile() in System.Net.WebClient after you get logged into the website?
0 Likes 0 ·

1 Answer

·
Terri avatar image
Terri answered
Yes. Here my code with the actual site and passwords removed. Imports System.IO Imports System.Net Imports System.Text Imports System.Web Imports system.Reflection.Assembly Public Class ScriptMain Public Const sSFTPWebSite As String = " https://xyz.net/From_abc/text.txt" Public Const sProxy As String = " http://abc.com/" Enum ScriptResults Success = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Success Failure = Microsoft.SqlServer.Dts.Runtime.DTSExecResult.Failure End Enum Public Shared Sub Main() Dim host As String = sSFTPWebSite Dim webClient As New WebClient webClient.Credentials = New NetworkCredential(userid, password) webClient.DownloadFile(host, "C:\ sample.txt") End Sub End Class
2 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

It is throwing a useful error or just failing to download the file?
0 Likes 0 ·
it's failing to download the file. "Virtual User XXXXX is logged on" is populated in the text file instead of the text file from the website.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.