How about Response.WriteFile?
I have something like this as part of a page:
Private Sub DownloadFile(ByVal ContentType As String, ByVal FileName As
String)
SendHeaders(ContentType, FileName)
SendFile(FileName)
End Sub
Private Sub SendHeaders(ByVal ContentType As String, ByVal FileName
As String)
Response.Clear()
Response.ContentType = ContentType
Response.AppendHeader("content-disposition", "attachment;
filename=" & FileName)
End Sub
Private Sub SendFile(ByVal FileName As String)
Dim sBaseDir As String = AppSettings.GetResourcesPath &
"/Download/"
Dim sPath As String = Server.MapPath(sBaseDir & FileName)
Response.WriteFile(sPath)
Response.End()
End Sub
John
> -----Original Message-----
> From: Moderated discussion of advanced .NET topics.
> [mailto:[EMAIL PROTECTED]] On Behalf Of
> Chad M. Gross
> Sent: Thursday, July 11, 2002 5:53 PM
> To: [EMAIL PROTECTED]
> Subject: Re: [ADVANCED-DOTNET] Response.Redirect issue
>
>
> The first should work but may be a refresh issue. The second
> one most likely should not work since it resolves to a
> physical path on the server but will work if you are using
> your local machine as the server right now.
>
> I would suggest the Response.BinaryWrite() and write out the
> bytes of the file though an aspx page. You will need to set
> the ContentType and the Content-Disposition header (it's good
> to set the extension header
> also) and make sure your aspx page is blank or contains only
> code if you're not using a code behind. Of course you will
> get slightly different behaviors in different browsers.
>
> Chad
> > -----Original Message-----
> > From: Farhan Shah [SMTP:[EMAIL PROTECTED]]
> > Sent: Thursday, July 11, 2002 9:04 AM
> > To: [EMAIL PROTECTED]
> > Subject: [ADVANCED-DOTNET] Response.Redirect issue
> >
> > I am not sure what i am doing wrong, but this is kinda freaky issue:
> >
> > I am trying to open a PDF file in virtual folder using following:
> > Response.Redirect("/carespring/Output/NEW.PDF")
> >
> > I get a blank page and when i click on refresh, it opens the file.
> >
> > But i do following, it opens the file from Server Path.
> >
> > Response.Redirect(Server.MapPath("/carespring/OutPut/NEW.PDF"))
> >
> > Any idea why is this happening?
> >
> > Thanks,
> > Farhan
> >
> > You can read messages from the Advanced DOTNET archive, unsubscribe
> > from Advanced DOTNET, or subscribe to other DevelopMentor lists at
> > http://discuss.develop.com.
>
> You can read messages from the Advanced DOTNET archive,
> unsubscribe from Advanced DOTNET, or subscribe to other
> DevelopMentor lists at http://discuss.develop.com.
>
You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.