Try This Way :
Code in
C#
using System;
using System.Xml;
using System.Web.Configuration;
using System.Web;
using System.Web.SessionState;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Diagnostics;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Web.UI;
public class AdClickHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
context.Response.ClearHeaders();
context.Response.ClearContent();
context.Response.AppendHeader("Pragma", "no-cache");
context.Response.AppendHeader("Cache-Control", "no-cache");
context.Response.CacheControl = "no-cache";
context.Response.Expires = -1;
context.Response.ExpiresAbsolute = new DateTime(1900, 1, 1);
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.ContentType = "application/application/vnd.ms-excel";
context.Response.BinaryWrite(MyByteArray);
context.Response.Flush();
}
public bool IsReusable
{
get
{
return false;
}
}
}
try the same
application/application/vnd.ms-excel
with
Ms-Word
Hope It Helps
:)