Click here to Skip to main content
15,908,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello friends,

i have open an pdf file after create in folder.
me write this code for that :-

C#
if (HttpContext.Current.Session["PDFCOD"] != null)
{
                        string PDFCODPath = Server.MapPath("~/FedExShipPDF/") + HttpContext.Current.Session["PDFCOD"].ToString();
ScriptManager.RegisterStartupScript(this, typeof(string), "New Window", "window.open('" + PDFCODPath + "')", true);
}


here new windows open but it not display any content. when i see in inspect element its give error like
could not open local resource " file\\\DCourierRateFedExShipPDF%7894582546.pdf

when i debuge my PDFCODPath will have D://CourierRate//FedExShipPDF//7894582546.pdf


Where i m wrong. i have tired to open pdf in browse..
Plz help..

Thank You...!!!
Posted
Updated 1-Nov-12 22:58pm
v2

1 solution

You can just use Repsonse.Redirect(pathToFile).
 
Share this answer
 
Comments
fjdiewornncalwe 2-Nov-12 16:46pm    
+5. Sounds like the easy way to do this.
Yatin chauhan 3-Nov-12 2:36am    
Response.redirect not open in new window. i have try to this too.
ZurdoDev 3-Nov-12 9:21am    
If you want to do it the way you were, with JavaScript, in your window.open you'll have to give the full URL, not the file path. That's because JS is executing on the client side so it will have to be "http://www....."
Yatin chauhan 3-Nov-12 9:29am    
it will create problem while i publish in my IIS. everytime same problem with print option from IIS.
ZurdoDev 3-Nov-12 17:13pm    
Sorry, what?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900