Re: Downloading Files
From: Paul Benati (pbenati_at_DONOTSPAMMEaps-soft.com)
Date: 05/16/03
- Next message: OlegG: "FormsAuthentication queston"
- Previous message: Matjaz Ladava: "Re: saving files in a remote computer"
- In reply to: Matjaz Ladava: "Re: Downloading Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 16 May 2003 08:23:49 -0400
Matjaz,
Yep, thanks!
Best regards,
----------------------
Paul Benati, MCP ASP.NET
VP Development
Advanced Productivity Software, Inc.
(770) 998 - 9698 x101
"Matjaz Ladava" <matjaz@ladava.com> wrote in message
news:%23ef9wByGDHA.3260@tk2msftngp13.phx.gbl...
> As you probably figured out, ASPNET account needs read permission to the
> file you are trying to read, because your application runs in the context
of
> ASPNET user account. Just change ACL's on the directory, to include ASPNET
> account for read permissions.
>
> Regards
>
> Matjaz Ladava
>
> "Paul Benati" <pbenati@DONOTSPAMMEaps-soft.com> wrote in message
> news:Oxb8KWxGDHA.2152@TK2MSFTNGP12.phx.gbl...
> > All,
> >
> > I've attempted to code up the ability for a user to download a file.
> Below
> > is the code excerpt...
> >
> > -----------------[ cut here ]------------------
> >
> > string filePath = "c:\foo.bar.cs";
> >
> > FileInfo file = new FileInfo(filePath);
> >
> > if(File.Exists(filePath))
> > {
> > Response.Clear();
> > Response.ContentType = "application/octet-stream";
> > Response.AddHeader("Content-Disposition", "attachment;
> > filename=\"" + file.Name + "\"");
> > Response.AddHeader("Content-Length", file.Length.ToString());
> > Response.Flush();
> > Response.WriteFile(filePath);
> > Response.End();
> > }
> >
> > -----------------------------------------------
> >
> > It appears that the code never enters the if clause not because the file
> > does not exist, but rather because the permissions are not correct. Can
> > anyone help me determine the best way to fix the permissions problem(s)?
> Is
> > the problem that the ASPNET account on my Win2000 server does not have
> > access to the physical file or is it that the .NET Framework (via the
> > machine.config file) is blocking my attempts to access such files? Or
> both?
> > Either way, what's the solution? TIA!
> >
> > Best regards,
> > ----------------------
> > Paul Benati, MCP ASP.NET
> > VP Development
> > Advanced Productivity Software, Inc.
> > (770) 998 - 9698 x101
> >
> >
>
>
- Next message: OlegG: "FormsAuthentication queston"
- Previous message: Matjaz Ladava: "Re: saving files in a remote computer"
- In reply to: Matjaz Ladava: "Re: Downloading Files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|