By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,386 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Displaying PDF file on ASP.net Page

P: n/a
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)?

Jun 7 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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).

---
Patrice
"c_shah" <sh*********@netzero.neta écrit dans le message de news:
11*********************@k79g2000hse.googlegroups.c om...
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)?

Jun 7 '07 #2

P: n/a
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...

--
Patrice
"Patrice" <http://www.chez.com/scribe/a écrit dans le message de news:
Og**************@TK2MSFTNGP04.phx.gbl...
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).

---
Patrice
"c_shah" <sh*********@netzero.neta écrit dans le message de news:
11*********************@k79g2000hse.googlegroups.c om...
>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)?


Jun 7 '07 #3

P: n/a
thanks
Jun 7 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.