Re: Downloading Files

From: Paul Benati (pbenati_at_DONOTSPAMMEaps-soft.com)
Date: 05/16/03


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
> >
> >
>
>



Relevant Pages

  • RE: Problem Writing a File from a Web Service
    ... it should have the same permissions as my Domain account. ... That leads me to believe that the web service isn't running under the ASPNET ... actually running under the ASPNET user credentials. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: ASP to ASP.NET Error 80070005 (JScript.NET)
    ... Permissions" and "Configuration Permissions" then save. ... COM object working for ASPNET. ... To get it working I had to remove the "Internet Guest Account" ... computer (where manually moving/adding -> restarting didn't work) I ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Server Application Unavailable
    ... You were right about the FP permissions. ... I have tried logging in as ASPNET with a password ASPNET/aspnet and also ... >> the installation directory allow access to the configured account. ... Go to a command prompt. ...
    (microsoft.public.frontpage.client)
  • Re: Problem: Process.GetProcessesByName : Couldnt get process information from remote machine
    ... If I put the ASPNET user into the local Administrators group it ... I obviously don't want the ASPNET account to have full admin rights in the ... > I have tried setting all sorts of permissions, ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: ASP FileSystemObject
    ... If the script is accessible by the IUSR_account ... then you'll be giving everyone write permissions! ... Regards, ...
    (microsoft.public.inetserver.iis.security)