Displaying PDF file on ASP.net Page

C

c_shah

using VB.net (VB 2005) ASP.net 2.0 on windows 2003 server

Dim strPDFFilePath AS string = "\\webserverhostname\d$\foldername
\filename"

the following code is diving me an error saying access denied

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "Application/PDF"
Response.WriteFile(strPDFFilePath)
Response.Flush()
Response.Close()
Response.End()

Account under which ASP.net is running have read, browser access to d:
drive and the folder in which file resides.

I guess it has something to do with drive name in the path?

Is there a way you can use Server.Mappath to map a different drive
(website is hosted on c: and file is on a different drive d: on the
same server)?
 
P

Patrice

AFAIK $ shares access is only allowed to administrative accounts. I would
create my own application specific share (remember you have also to apply
the appropriate rights to the share plus it's likely better to avoid sharing
the drive root).
 
P

Patrice

Oups. I saw by reading again that files are actually on drive d: on the
*same*machine . You could perhaps just use the drive letter ie.
d:\MyWebApps\ThisWebApp\TheFileWant.pdf ? and use a config setting to point
to the root location for this application files...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top