Impersonation and Path.GetTempPath()

Discussion in 'ASP .Net' started by Oleg Ogurok, Aug 25, 2004.

  1. Oleg Ogurok

    Oleg Ogurok Guest

    Hi all,

    I have a ASP.NET app that uses Excel interop to save an .xls file on disk in
    a temp folder and then read it back and e-mails it as an attachment.

    The problem is deciding where to store the temp file. My web.config has
    <identity impersonate="true" />


    When I call System.IO.Path.GetTempPath(), it returns
    C:\DOCUME~1\MYSERVER\ASPNET\LOCALS~1\Temp. However, when I try to save the
    file, I get an error saying "Microsoft Office Excel cannot access the file."
    It seems despite the impersonation, I still get the home dir of ASPNET user
    instead of the user under which the IIS virtual directory is running. Is
    there a more correct way of getting a temp path?

    Thanks.

    -Oleg.
     
    Oleg Ogurok, Aug 25, 2004
    #1
    1. Advertising

  2. Oleg Ogurok

    bruce barker Guest

    impersonation only changes the thread's credentials, not the profile
    associated with the process. a user profile is where temp, default printer,
    etc settings are stored. in fact asp.net usually runs without a profile.

    -- bruce (sqlwork.com)


    "Oleg Ogurok" <> wrote in message
    news:...
    > Hi all,
    >
    > I have a ASP.NET app that uses Excel interop to save an .xls file on disk

    in
    > a temp folder and then read it back and e-mails it as an attachment.
    >
    > The problem is deciding where to store the temp file. My web.config has
    > <identity impersonate="true" />
    >
    >
    > When I call System.IO.Path.GetTempPath(), it returns
    > C:\DOCUME~1\MYSERVER\ASPNET\LOCALS~1\Temp. However, when I try to save the
    > file, I get an error saying "Microsoft Office Excel cannot access the

    file."
    > It seems despite the impersonation, I still get the home dir of ASPNET

    user
    > instead of the user under which the IIS virtual directory is running. Is
    > there a more correct way of getting a temp path?
    >
    > Thanks.
    >
    > -Oleg.
    >
    >
     
    bruce barker, Aug 25, 2004
    #2
    1. Advertising

  3. Oleg Ogurok

    Phil Wilson Guest

    This is what the LoadUserProfile Win32 API is for - don't know if there's a
    framework equivalent.
    --
    Phil Wilson [MVP Windows Installer]
    ----
    "Oleg Ogurok" <> wrote in message
    news:...
    > Hi all,
    >
    > I have a ASP.NET app that uses Excel interop to save an .xls file on disk

    in
    > a temp folder and then read it back and e-mails it as an attachment.
    >
    > The problem is deciding where to store the temp file. My web.config has
    > <identity impersonate="true" />
    >
    >
    > When I call System.IO.Path.GetTempPath(), it returns
    > C:\DOCUME~1\MYSERVER\ASPNET\LOCALS~1\Temp. However, when I try to save the
    > file, I get an error saying "Microsoft Office Excel cannot access the

    file."
    > It seems despite the impersonation, I still get the home dir of ASPNET

    user
    > instead of the user under which the IIS virtual directory is running. Is
    > there a more correct way of getting a temp path?
    >
    > Thanks.
    >
    > -Oleg.
    >
    >
     
    Phil Wilson, Aug 25, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Keith-Earl
    Replies:
    1
    Views:
    2,025
    Peter O'Reilly
    May 3, 2004
  2. Replies:
    0
    Views:
    2,298
  3. Mupota Muchelemba
    Replies:
    1
    Views:
    950
    Tony Morris
    Feb 4, 2004
  4. Jurko Gospodnetiæ

    os.path.realpath() and os.path.abspath()

    Jurko Gospodnetiæ, Jan 11, 2011, in forum: Python
    Replies:
    1
    Views:
    564
    Adam Skutt
    Jan 12, 2011
  5. Ethan Furman

    os.path and Path

    Ethan Furman, Jun 16, 2011, in forum: Python
    Replies:
    12
    Views:
    352
Loading...

Share This Page