I am trying to save an Excel file to a share location.
protected void Button1_Click(object sender, EventArgs e)
{
string conn = ConfigurationManager.ConnectionStrings["NameConn"].ConnectionString;
DataTable dt = new DataTable();
using (SqlConnection odbcCon = new SqlConnection(conn))
{
odbcCon.Open();
SqlCommand cmd = new SqlCommand("GetValues", odbcCon);
cmd.Parameters.AddWithValue("@Name", "abc");
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(dt);
}
string destFilename = HttpContext.Current.Server.MapPath("~/A.xls");
System.Net.WebClient client = new System.Net.WebClient();
client.DownloadFile(path, destFilename);
}
Web.config
<httpRuntime targetFramework="4.5" executionTimeout="10000" maxRequestLength="2147483647" shutdownTimeout="360" />
And I get this error:
- The operation has timed out.
Can you tell me where I could be wrong.