New thread - not same credentials?

Discussion in 'ASP .Net' started by Casper Hornstrup, Nov 26, 2003.

  1. I upload an excel file, save it on the webserver and import the contents to
    an MSSQL database.
    I use the MS JET OleDb provider to read from the excel file. If I do this
    during the HTTP
    request this works fine. If however I let another thread (from a pool I've
    created when
    the ASP.NET application was first started) do the job, the OleDb provider
    returns E_FAIL.
    If I give Everyone full rights on the file, it works when the new thread is
    used.
    This is on a Windows Server 2003 btw. When the file is uploaded, it receives
    Special (Allow List folder / Read data, Allow Delete) for NETWORK SERVICE.
    The ASPNET user is not in the ACL. How can I solve this problem?

    Casper
    Casper Hornstrup, Nov 26, 2003
    #1
    1. Advertising

  2. Casper Hornstrup

    Alvin Bruney Guest

    It should not be working for you at all. Well at least, that's the mind set
    you should have because you've violated a major thread law here. Threads are
    not allowed to tamper with objects belonging to the main thread. The main
    thread owns the http object, your worker thread does not. Results will
    typically be flakey, working sometimes, failing at others because of the way
    requests are scheduled underneath the hood.

    To work around this, you can try passing a reference to the http object to
    the worker thread. This will allow the worker thread to safely modify the
    object and guarantee consitency. So from the pool of threads you created,
    let one of the parameters be a httpcontext object.

    --
    Regards,
    Alvin Bruney
    Got Tidbits? Get it here
    www.networkip.net/tidbits
    "Casper Hornstrup" <> wrote in message
    news:uiRBHu$...
    > I upload an excel file, save it on the webserver and import the contents

    to
    > an MSSQL database.
    > I use the MS JET OleDb provider to read from the excel file. If I do this
    > during the HTTP
    > request this works fine. If however I let another thread (from a pool I've
    > created when
    > the ASP.NET application was first started) do the job, the OleDb provider
    > returns E_FAIL.
    > If I give Everyone full rights on the file, it works when the new thread

    is
    > used.
    > This is on a Windows Server 2003 btw. When the file is uploaded, it

    receives
    > Special (Allow List folder / Read data, Allow Delete) for NETWORK SERVICE.
    > The ASPNET user is not in the ACL. How can I solve this problem?
    >
    > Casper
    >
    >
    Alvin Bruney, Nov 30, 2003
    #2
    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. Gawel
    Replies:
    1
    Views:
    394
    Alvin Bruney
    Dec 31, 2003
  2. Wael
    Replies:
    1
    Views:
    277
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Sep 19, 2007
  3. =?Utf-8?B?cGxleDRy?=
    Replies:
    0
    Views:
    353
    =?Utf-8?B?cGxleDRy?=
    Nov 13, 2007
  4. maa
    Replies:
    2
    Views:
    1,124
    S. Justin Gengo
    Feb 10, 2008
  5. QQ
    Replies:
    6
    Views:
    451
    Roedy Green
    Mar 28, 2008
Loading...

Share This Page