Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 19th May 2010, 01:04 PM   #1
HyperActive Warrior
War Room Member
 
osegoly's Avatar
 
Join Date: 2009
Location: Vancouver ,BC
Posts: 136
Thanks: 10
Thanked 11 Times in 10 Posts
Post
PDF Streaming in ASP.NET
Share on: 
fb share twitter share gplus share more share

Hi All,

On one of my websites (ASP.NET-based) I offer a bunch of PDFs for my users to download. There's also a private side, where I offer some private PDFs to members only.

On the private side, I use PDF streaming (Application/pdf approach) as I do not want my users to know where those PDF files are located on my server.

The issue I am having is with Safari users on Mac OS. For some reason it does not load the PDF files for these users. On all other browsers and platforms it works perfectly fine.

I've included my code below (stripped it down a bit for security reasons). Any help will be much appreciated.

Dim fname As String = ""
Dim folderName As String = Server.MapPath("/pdfs/private-pdfs/")

fname = Request.QueryString("cmd").ToString.Trim()

Dim extStr As Array
extStr = fname.Split(".")

Response.ContentType = "Application/pdf"

Dim FilePath As String = folderName & fname
Response.WriteFile(FilePath)
Response.End()
osegoly is offline  
Unread 19th May 2010, 02:23 PM   #2
New Warrior Member
War Room Member
 
Join Date: 2007
Location: Norderstedt (near Hamburg), Germany
Posts: 6
Thanks: 1
Thanked 2 Times in 2 Posts
Default
Re: PDF Streaming in ASP.NET
Share on: 
fb share twitter share gplus share more share

here is my code in c# -


string path = MapPath("\\Admin\\Uploads\\" + downloadID);
string name = getFileName(downloadID);

Response.AppendHeader("content-disposition","attachment; filename=" + name);

Response.ContentType = "application/octet-stream";
Response.WriteFile(path);
Response.End();
jaythedane is offline  
The Following User Says Thank You to jaythedane For This Useful Post:
Unread 19th May 2010, 03:01 PM   #3
HyperActive Warrior
War Room Member
 
osegoly's Avatar
 
Join Date: 2009
Location: Vancouver ,BC
Posts: 136
Thanks: 10
Thanked 11 Times in 10 Posts
Default
Re: PDF Streaming in ASP.NET
Share on: 
fb share twitter share gplus share more share

Perfect. Thanks a lot
osegoly is offline  
Unread 19th May 2010, 03:56 PM   #4
New Warrior Member
War Room Member
 
Join Date: 2007
Location: Norderstedt (near Hamburg), Germany
Posts: 6
Thanks: 1
Thanked 2 Times in 2 Posts
Default
Re: PDF Streaming in ASP.NET
Share on: 
fb share twitter share gplus share more share

you're welcome
jaythedane is offline  
Closed Thread


Bookmarks

Tags
aspnet, pdf, streaming


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 04:10 AM.