Forum Moderators: open
Most users get a file download dialog and can choose to save the file locally which works like a champ but some users choose to open the file in their browser. This works perfectly fine until the user then attempts to File ¦ Save As. If they do that then the server prompts for Netword Security Credentials. Too, some users don't even receive a file download dialog, sometimes the browser will bypass that and immediately open the file.
Any ideas why that would be occurring? IUSR has read and the aspnet user has the whole enchalada. How can I force the file download dialog to appear too?
Code looks like this (assume all paramater variables are set accordingly)
ws.webservice et = new ws.webservice();
DataSet vDataSet = et.GetResportAsXml(_userName, _passWord, _manId, _startDate, _endDate, true);
dg.DataSource = vDataSet;
dg.DataBind();
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new System.Web.UI.HtmlTextWriter(stringWrite);
dg.RenderControl(htmlWrite);
Response.Clear();
Response.Buffer = true;
Response.ContentType = "application/vnd.ms-excel";
Response.Charset = "";
this.EnableViewState = false;
Response.Write(stringWrite.ToString());
Response.End();
FireFox handles this differently and a little smoother... ff doesn't display the excel directly in the browser rather it locates the application assosciated with the content type and asks the user if they want to open the file with that program or you get the option to browse to another program.