User1046245955 posted
how to open a new window/tab using c# .net
here's my code:
.aspx
<asp:Button ID="bttnpdf" runat="server" Text="<%$ Resources:LocalizedResources, View %>" Width="120px" CssClass="btn yellow pull-left" OnClick="bttnpdf_Click" />
code behind:
protected void bttnpdf_Click(object sender, EventArgs e)
{
string mattach = Session["atta"].ToString();
string FilePath = @"http://server/FileAttachment/" + mattach;
WebClient User = new WebClient();
Byte[] FileBuffer = User.DownloadData(FilePath);
if (FileBuffer != null)
{
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", FileBuffer.Length.ToString());
Response.BinaryWrite(FileBuffer);
}
}