Re: Response.TransmitFile() problem over network

Tech-Archive recommends: Speed Up your PC by fixing your registry



Thanks Gregory, I'll talk to our network administrators and see if I can
implement your recommended approach. I'll let you know how I get on.
Julia.

"Gregory A. Beamer" wrote:

=?Utf-8?B?SnVsaWEgQg==?= <JuliaB@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:118AD9BC-2262-4275-B30D-82A16991C32E@xxxxxxxxxxxxx:

Hi, I've got an ASP.NET 2.0 application where I need to open files. I
had it working on my local webserver, with the files on my C drive.

However I've now published the application to our production web
server (Windows 2003 SP2) and the files are on a shared folder within
that web server.

If I try and run the application on the webserver the transmit file
just times out. If I try and run the application in debug mode (i.e on
my local webserver connecting to the files on the production web
server) the transmit file causes an instance of Word or Excel as
relevant to open but the file is blank.

The files concerned are very very small, just a few bytes in some
cases, so I know it's not a file size issue. I've also checked
permissions and the ASPNET account has the correct permissions (I've
checked this by saving files to the same shared folder using the
application).

Does anyone have any hints? Here's the code:

Response.Buffer = False
Response.Clear()
Response.ClearHeaders()
'now get the record name
If e.CommandName = "OrigRecord" Then
filePath = selectedRow.Cells(9).Text
filePath = Global.Global_asax.calRecordFilePath & filePath
Response.AppendHeader("Content-Disposition", "attachment;filename="
&
System.IO.Path.GetFileName(filePath))
Response.ContentType = "text/csv"
Else
filePath = selectedRow.Cells(10).Text
filePath = Global.Global_asax.calReportFilePath & filePath
Response.AppendHeader("Content-Disposition", "attachment;filename="
&
System.IO.Path.GetFileName(filePath))
Response.ContentType = "application/msword"
End If
'now we've got the full path for the file, open it
Response.TransmitFile(filePath)
Response.End()

Thanks in advance
Julia


Share folder? Outside of the application like below?

IIS Root
--> Web Application
--> Shared Folder

If so, the issue is IIS does not allow transversal of the file system.
It only allows you to read things under root. I don't have the specifics
in front of me, but you can turn this feature off (google it). Realize
there are potential security implications. I would not recommend this
approach, unless you cannot do my second recommendation (below):

You can also "trick" IIS to allowing you to use this directory. Every
site that needs to hit this directory adds the folder (aliased, if
necessary) to the web site (In IIS, this is done by adding a new virtual
folder to the application folder).

No matter which approach, make sure you have the proper permissions for
the account ASP.NET is running under. If that account cannot read the
files, you will not be able to serve them up.



--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

******************************************
| Think outside the box! |
******************************************

.



Relevant Pages

  • Re: Response.TransmitFile() problem over network
    ... had it working on my local webserver, with the files on my C drive. ... server and the files are on a shared folder within ... filePath = Global.Global_asax.calRecordFilePath & filePath ... the issue is IIS does not allow transversal of the file system. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Public folders not replicating to new Exchange 2000 server
    ... I do strongly recommend doing this before trying anything else. ... also recommend running it on both public folder stores at the same time. ... How to Reset System Folders on an Exchange 2000 Server ... >> Have you tried mounting a new public folder store on the new E2k3 ...
    (microsoft.public.exchange2000.information.store)
  • Re: Response.TransmitFile() problem over network
    ... had it working on my local webserver, with the files on my C drive. ... server and the files are on a shared folder within ... filePath = Global.Global_asax.calRecordFilePath & filePath ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: roaming profile and outlook .pst.
    ... but I do need to thank you for mentioning it here for ... I understand that MS does not recommend placing pst files on ... profiles is outlook .pst folder. ...
    (microsoft.public.windows.server.sbs)
  • Re: Change the working dir (App.Path) when debuging
    ... I'd recommend using a function like this. ... >> In the common location are some configuration files that are accessed ... >> When I try to debug it, the app.path changes from my common folder to the ...
    (microsoft.public.vb.general.discussion)