Professional Web Applications Themes

Impersonate code sample? - ASP.NET Security

Here is what I do in order to use Windows security: 1. Set up IIS to use the domain account you have set up as the anonymous user 2. Set up ASP.NET to impersonate, so it will use this domain account. Just add <identity impersonate="true"> to web.config 3. Set up permissions for this account on the SQL Server 4. Start using Windows Security If you have any components that you access, don't forget to give the domain account access to them as well. I do this for Forms Authentication - I assume it is similar for Windows Authentication, but can't ...

  1. #1

    Default Re: Impersonate code sample?

    Here is what I do in order to use Windows security:

    1. Set up IIS to use the domain account you have set up as the anonymous
    user
    2. Set up ASP.NET to impersonate, so it will use this domain account. Just
    add <identity impersonate="true"> to web.config
    3. Set up permissions for this account on the SQL Server
    4. Start using Windows Security

    If you have any components that you access, don't forget to give the domain
    account access to them as well.

    I do this for Forms Authentication - I assume it is similar for Windows
    Authentication, but can't personally comment on things to look out for.

    --
    Chris Jackson
    Software Engineer
    Microsoft MVP - Windows XP
    Windows XP Associate Expert
    --
    "Cowboy (Gregory A. Beamer)" <NoSpamMgbworldcomcast.netRemuvThis> wrote in
    message news:u2ThbiVTDHA.1324TK2MSFTNGP11.phx.gbl...
    > One of the guys at work is creating an ASP.NET app against a legacy COM
    > component that uses SQL Server Integrated security. Somewhere recently, I
    > saw a code sample that showed how to impersonate an account for data
    access
    > by changing the identity of the thread the ASP.NET application was running
    > under. To save him some time, does anyone have a link to a sample like
    this.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > Author: ADO.NET and XML: ASP.NET on the Edge
    >
    >
    ************************************************** **************************
    > ****
    > Think Outside the Box!
    >
    ************************************************** **************************
    > ****
    >
    >

    Chris Jackson Guest

  2. #2

    Default Re: Impersonate code sample?

    Here is some code that you may be able to use.

    [url]http://www.netomatix.com/ImpersonateUser.aspx[/url]

    Naveen

    "Cowboy (Gregory A. Beamer)" <NoSpamMgbworldcomcast.netRemuvThis> wrote in
    message news:u2ThbiVTDHA.1324TK2MSFTNGP11.phx.gbl...
    > One of the guys at work is creating an ASP.NET app against a legacy COM
    > component that uses SQL Server Integrated security. Somewhere recently, I
    > saw a code sample that showed how to impersonate an account for data
    access
    > by changing the identity of the thread the ASP.NET application was running
    > under. To save him some time, does anyone have a link to a sample like
    this.
    >
    > --
    > Gregory A. Beamer
    > MVP; MCP: +I, SE, SD, DBA
    > Author: ADO.NET and XML: ASP.NET on the Edge
    >
    >
    ************************************************** **************************
    > ****
    > Think Outside the Box!
    >
    ************************************************** **************************
    > ****
    >
    >

    Naveen K Kohli Guest

  3. #3

    Default Re: Impersonate code sample?

    I downloaded the Sample source code and modified it to match my
    username, password, and domain in my office.
    I tried the permutations of LogonType and LogonProvider for w2k, and
    unfortunately, I could not get the example to work

    Has anyone been able to successfully implement Impersonation on Windows
    2000 Server?
    If so, could you share a sample of source code?

    Thanks,
    Brian

    "Naveen K Kohli" <naveenkohlihotmail.com> wrote in message
    news:e%23wfxIaTDHA.2092TK2MSFTNGP10.phx.gbl...
    > Here is some code that you may be able to use.
    >
    > [url]http://www.netomatix.com/ImpersonateUser.aspx[/url]
    >
    > Naveen
    >
    > "Cowboy (Gregory A. Beamer)" <NoSpamMgbworldcomcast.netRemuvThis> wrote
    in
    > message news:u2ThbiVTDHA.1324TK2MSFTNGP11.phx.gbl...
    > > One of the guys at work is creating an ASP.NET app against a legacy COM
    > > component that uses SQL Server Integrated security. Somewhere recently,
    I
    > > saw a code sample that showed how to impersonate an account for data
    > access
    > > by changing the identity of the thread the ASP.NET application was
    running
    > > under. To save him some time, does anyone have a link to a sample like
    > this.
    > >
    > > --
    > > Gregory A. Beamer
    > > MVP; MCP: +I, SE, SD, DBA
    > > Author: ADO.NET and XML: ASP.NET on the Edge
    > >
    > >
    >
    ************************************************** **************************
    > > ****
    > > Think Outside the Box!
    > >
    >
    ************************************************** **************************
    > > ****
    > >
    > >
    >
    >

    Brian Pieslak Guest

Similar Threads

  1. DownloadProgressBar sample code
    By j2eesatish in forum Macromedia Flex General Discussion
    Replies: 1
    Last Post: June 27th, 10:05 PM
  2. Code Sample
    By y c a r t in forum Macromedia Flex General Discussion
    Replies: 3
    Last Post: September 8th, 08:07 PM
  3. Impersonate by code and printers ?
    By Pascal Gineste in forum ASP.NET Security
    Replies: 0
    Last Post: September 9th, 04:11 PM
  4. ethernet sample code
    By Steve Modica in forum Mac Networking
    Replies: 0
    Last Post: September 9th, 04:35 PM
  5. DB Sample Code
    By Frank Py in forum ASP Database
    Replies: 3
    Last Post: July 2nd, 02:28 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