dear All ,
I am trying to download a file from Web Server to my local machine.
I am using .Net Framework 1.1 and Visual Studio 2003
this is snipet of code I have used.
private void Button2_ServerClick(object sender, System.EventArgs e)
{
string connString = "Data Source=cdodev;User Id=security;Password=security;Integrated Security=no;";
OracleConnection conn = new OracleConnection(connString);
DataSet ds = new DataSet();
try
{
//string parentLink = TextBox_ParentLink.Text;
string series = TextBox_Series.Text;
string type = DropDownList_Type.SelectedItem.Text;
conn.Open();
string dataString = "select b.url from tbl_crawler b where b.parentlink = '" + TextBox_ParentLink.Text.Trim() + "'";
OracleCommand cmd = new OracleCommand(dataString, conn);
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
if (dr.Read())
{
// C# retrieve the first column in the select list
string parentLink = dr.GetString(0);
string url = parentLink + series + "." + type ;
Response.Redirect(url);
}
else
{
lblError.Text="Invalid Trustee Site";
}
//Response.Redirect(" http://www.hide-link.com/ ;);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
finally
{
conn.Close();
}
This will capture allias from user and from the backend get the actual url.
This is working fine for non-password sites,most of the sites are password protected , and I want to automate
download from this sites. I have the legal UserName and password of the Sites.
.NET Development22
|