Hi all,
I got my functionality working in the IE browser, but i would like to get it to work for firefox too. First let me show you the code:
Im guessing its has something to do with the header, but im not sure. Keep in mind i didnt add a header in IE, would love this to work in FireFox.Code:public void LoadData() { try { DbUtils.StartTransaction(); VwPersonExerciseIDResultRecord rec = VwPersonExerciseIDResultView.GetRecord("ID=" + this.Page.Request.QueryString["docID"]); string filename = rec.FileName; byte[] contents = rec.FileContent; if(filename.EndsWith(".doc")) Page.Response.ContentType = "application/msword"; else if(filename.EndsWith(".txt")) Page.Response.ContentType = "text/plain"; else if(filename.EndsWith(".pdf")) Page.Response.ContentType = "application/pdf"; else if(filename.EndsWith(".jpg") || filename.EndsWith(".jpeg")) Page.Response.ContentType = "image/jpeg"; else if (filename.EndsWith(".gif")) Page.Response.ContentType = "image/gif"; else if(filename.EndsWith(".xls")) Page.Response.ContentType = "application/vnd.ms-excel"; Page.Response.AppendHeader("content-disposition", "inline; filename=" + filename); Page.Response.OutputStream.Write(contents, 0, contents.Length); Page.Response.End(); } catch (Exception ex) { DbUtils.RollBackTransaction(); // Report the error message to the user. BaseClasses.Utils.MiscUtils.RegisterJScriptAlert(this, "UNIQUE_SCRIPTKEY", ex.Message); } finally { DbUtils.EndTransaction(); } }
Many thanks, Figa




Reply With Quote