Impersonate code sample?

Ask a Question related to ASP.NET Security, Design and Development.

  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)" <NoSpamMgbworld@comcast.netRemuvThis> wrote in
    message news:u2ThbiVTDHA.1324@TK2MSFTNGP11.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. Similar Questions and Discussions

    1. DownloadProgressBar sample code
      Hi, while loading my applicaion i want to show DownloadProgressBar. I have refered the Adobe site. Thare it is menctioned as Flex2.0 beta version....
    2. Code Sample
      I found this link referenced in another thread - http://flexapps.macromedia.com/flex15/explorer/dragdrop/DragDropGrid.mxml?versio nChecked=true and...
    3. Impersonate by code and printers ?
      We want to convert an excel file to a pdf file using a PDF printer driver. This uses a Postscript printer driver with a redirected port...
    4. ethernet sample code
      Does anyone have a copy of the ethernet sample code that is refernced in the Netdoc.pdf? I can't seem to find that. Steve
    5. DB Sample Code
      I'm looking for some sample code that functions as an Access table editor. I had one that gave me a table grid with the hyperlink options to edit,...
  3. #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)" <NoSpamMgbworld@comcast.netRemuvThis> wrote in
    message news:u2ThbiVTDHA.1324@TK2MSFTNGP11.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

  4. #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" <naveenkohli@hotmail.com> wrote in message
    news:e%23wfxIaTDHA.2092@TK2MSFTNGP10.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)" <NoSpamMgbworld@comcast.netRemuvThis> wrote
    in
    > message news:u2ThbiVTDHA.1324@TK2MSFTNGP11.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

Posting Permissions

  • You may not post new threads
  • You may 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