Professional Web Applications Themes

Impersonate in ThreadPool - ASP.NET Security

Hi all I have an ASP.NET application that uses impersonate account to connect to DB, this works good. But in some cases I need to put some methods in ThreadPool. The methods from ThreadPool should do some foreground operations with DB. But .NET throws me the sql exception "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.". The thread from pool in execution proccess has an ASPNET account different from my impersonated account. How can I resolve this problem, do you have any suggestions? with best regards Viorel...

  1. #1

    Default Impersonate in ThreadPool

    Hi all

    I have an ASP.NET application that uses impersonate account to connect to DB, this works good. But in some cases I need to put some methods in ThreadPool. The methods from ThreadPool should do some foreground operations with DB. But .NET throws me the sql exception "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.". The thread from pool in execution proccess has an ASPNET account different from my impersonated account. How can I resolve this problem, do you have any suggestions?

    with best regards
    Viorel

    Viorel Ghilas Guest

  2. #2

    Default Impersonate in ThreadPool

    Unfortunately impersonation tokens are not copied to new threads (this is 'fixed' in .NET 2.0).

    you have to impersonate the account on the new thread - that's the only solution.



    Dominick Baier - DevelopMentor
    [url]http://www.leastprivilege.com[/url]

    nntp://news.microsoft.com/microsoft.public.dotnet.framework.aspnet.security/<#WRqVfcCFHA.444TK2MSFTNGP15.phx.gbl>

    Hi all I have an ASP.NET application that uses impersonate account to connect to DB, this works good. But in some cases I need to put some methods in ThreadPool. The methods from ThreadPool should do some foreground operations with DB. But .NET throws me the sql exception "Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.". The thread from pool in execution proccess has an ASPNET account different from my impersonated account. How can I resolve this problem, do you have any suggestions? with best regards
    Viorel
    This post contained attachments. By default, NewsGator will not download attachments, but can be configured to do so. If you wish to automatically download attachments for this newsgroup, go to NewsGator/Subscriptions, select this group and click Edit, and change the Options.


    [microsoft.public.dotnet.framework.aspnet.security]
    Dominick Baier [DevelopMentor] Guest

Similar Threads

  1. CF7 Hanging; Memory &/orjrunx.scheduler.ThreadPool$Throttle
    By GaryG in forum Coldfusion Server Administration
    Replies: 1
    Last Post: February 14th, 07:30 PM
  2. Change Max number of thread in threadpool
    By Franck in forum ASP.NET Web Services
    Replies: 1
    Last Post: April 25th, 08:40 PM
  3. DirectoryEntry Impersonate or WindowsIdentity Impersonate?
    By Bill Belliveau in forum ASP.NET Security
    Replies: 3
    Last Post: January 31st, 04:19 AM
  4. Not enough free threads in the ThreadPool
    By Wil Burton in forum ASP.NET Web Services
    Replies: 2
    Last Post: August 12th, 01:30 PM
  5. ThreadStaticAttribute and threadpool
    By bruce barker in forum ASP.NET General
    Replies: 1
    Last Post: July 11th, 09:51 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139