Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export DataGrid to Excel/Word over HTTPS

Status
Not open for further replies.

tcstom

Programmer
Aug 22, 2003
235
GB
I have a web form that employs the following method attached to a button click to export a datagrid to either Excel or Word (by passing the string "xls" or "doc" as the parameter)...

Code:
private void ExportReport(string extension)
{
	Response.Clear();
	Response.AddHeader("content-disposition", "attachment;filename=" + report_container.ThisReport.Name + "." + extension);
	Response.Charset = "";
	Response.Cache.SetCacheability(HttpCacheability.NoCache);
	Response.ContentType = "application/vnd." + extension;
	System.IO.StringWriter stringWrite = new System.IO.StringWriter();
	System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
	report_container.report_data_table.RenderControl(htmlWrite);
	Response.Write(stringWrite.ToString());
	Response.End();
}

...which works fine normally but when the web site is running over the HTTPS protocol this gives the error "Internet Explorer was not able to open the Internet site. The requested site is either unavailable or cannot be found. Please try again later."

Anyone know if anything can be done about this?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top