code:
string embed = "";
ltEmbed.Text = string.Format(embed, ResolveUrl("~/Handlers/Handler.ashx?type=test&Id=" + 1));
Handler code:
if (context.Request.QueryString["type"].ToLower() == "test")
{
string test = "hii sanjay";/* context.Session["sr"].ToString();*/
byte[] bytes =Encoding.UTF8.GetBytes(test);
ViewDocuments(context, bytes);
}
//Document View
public void ViewDocuments(HttpContext context, byte[] bytes)
{
if (bytes != null)
{
context.Response.Buffer = true;
context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
context.Response.ContentType = "application/pdf";
context.Response.BinaryWrite(bytes);
context.Response.Flush();
context.Response.End();
}
}
i written this code into handler
when click on view button
Failed to load PDF document i got this message
Uehara AyakaPosted Apr 11, 2017, 9:30 PM
Bhuvanesh MohankumarPosted Apr 11, 2017, 3:26 PM