DPAPI Enterprise Services Example

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

  1. #1

    Default DPAPI Enterprise Services Example

    I am trying to work through the sample from msdn, "How To Use DPAPI (User
    Store) from ASP.NET with Enterprise Services". I thought I had everything
    configured correctly. I tried to test the service and get the following
    error.(Sorry for encluding every line). I am confused as to what setting is
    incorrectly set. Additionally, the paragraph on giving asp.net access doesn't
    help me at all. Thanks for help, as I don't want to keep thrashing about. Any
    advice on where to read more about security in general is appreciated.

    Exception Details: System.UnauthorizedAccessException: Access is denied.
    ASP.NET is not authorized to access the requested resource. Consider
    granting access rights to the resource to the ASP.NET request identity.
    ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or
    Network Service on IIS 6) that is used if the application is not
    impersonating. If the application is impersonating via <identity
    impersonate="true"/>, the identity will be the anonymous user (typically
    IUSR_MACHINENAME) or the authenticated request user.

    To grant ASP.NET write access to a file, right-click the file in Explorer,
    choose "Properties" and select the Security tab. Click "Add" to add the
    appropriate user or group. Highlight the ASP.NET account, and check the boxes
    for the desired access.

    Source Error:
    Line 59: private void btnEncrypt_Click(object sender, System.EventArgs e)
    Line 60: {
    Line 61: DataProtectorComp dp = new DataProtectorComp();
    Line 62: try
    Line 63: {

    Source File: c:\documents and
    settings\bill\vswebcache\billfun\dpapiweb\webform1 .aspx.cs Line: 61

    Stack Trace:

    [UnauthorizedAccessException: Access is denied.]
    System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32
    errorCode, IntPtr errorInfo) +0
    System.EnterpriseServices.Thunk.Proxy.CoCreateObje ct(Type serverType,
    Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581

    System.EnterpriseServices.ServicedComponentProxyAt tribute.CreateInstance(Type
    serverType) +181

    System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Type
    serverType, Object[] props, Boolean bNewObj) +74
    DPAPIWeb.WebForm1.btnEncrypt_Click(Object sender, EventArgs e) in
    c:\documents and settings\bill
    heckle\vswebcache\billfun\dpapiweb\webform1.aspx.c s:61
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108

    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +57
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    sourceControl, String eventArgument) +18
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
    System.Web.UI.Page.ProcessRequestMain() +1277




    Bill Heckle Guest

  2. Similar Questions and Discussions

    1. DPAPI
      Hi everyone. I'm creating an app that stores DB connection strings in the web config file. I'm using the MSDN resources at...
    2. I've installed a commercial copy of 2003 Enterprise over a 2003 enterprise trial and activation troubles ...
      Hi I've installed a commercial copy of 2003 Enterprise over a 2003 enterprise activated trial version. After logon the system says that I must...
    3. securing ASP.NET with Enterprise Services
      I am building an ASP.NET application, with the following idea. The project is split into three layers UI, BLL and DAL. The UI (webpages) with...
    4. Web services are not working on win2003 server Enterprise edition
      Hi I have created a simple "Hello world" ASP.NET web service for tesing purpose. This runs well on windows2000 machines but if I deploy in the...
    5. WS / Com+ -> Enterprise services and Transactions
      Hi, I'm doing a study on how to implement Transactionmanagement into our coming ..Net projects. We have earlier worked with Sybase XA and BEA...
  3. #2

    Default Re: DPAPI Enterprise Services Example

    Looks like you are using a ServicedComponent in COM+? That may complicate
    things a little but you may need to give read/write access to whichever user
    you are running under (might be ASPNET, NETWORK SERVICE, or the defined
    identity in COM+) to your "\Document And
    Settings\{user}\ApplicationData\Crypto" directory.

    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "Bill Heckle" <billheckle.spam@hotmail.com> wrote in message
    news:D0CD2FDF-F29C-46E4-955A-5665AFE9603A@microsoft.com...
    > I am trying to work through the sample from msdn, "How To Use DPAPI (User
    > Store) from ASP.NET with Enterprise Services". I thought I had everything
    > configured correctly. I tried to test the service and get the following
    > error.(Sorry for encluding every line). I am confused as to what setting
    is
    > incorrectly set. Additionally, the paragraph on giving asp.net access
    doesn't
    > help me at all. Thanks for help, as I don't want to keep thrashing about.
    Any
    > advice on where to read more about security in general is appreciated.
    >
    > Exception Details: System.UnauthorizedAccessException: Access is denied.
    > ASP.NET is not authorized to access the requested resource. Consider
    > granting access rights to the resource to the ASP.NET request identity.
    > ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
    or
    > Network Service on IIS 6) that is used if the application is not
    > impersonating. If the application is impersonating via <identity
    > impersonate="true"/>, the identity will be the anonymous user (typically
    > IUSR_MACHINENAME) or the authenticated request user.
    >
    > To grant ASP.NET write access to a file, right-click the file in Explorer,
    > choose "Properties" and select the Security tab. Click "Add" to add the
    > appropriate user or group. Highlight the ASP.NET account, and check the
    boxes
    > for the desired access.
    >
    > Source Error:
    > Line 59: private void btnEncrypt_Click(object sender, System.EventArgs e)
    > Line 60: {
    > Line 61: DataProtectorComp dp = new DataProtectorComp();
    > Line 62: try
    > Line 63: {
    >
    > Source File: c:\documents and
    > settings\bill\vswebcache\billfun\dpapiweb\webform1 .aspx.cs Line: 61
    >
    > Stack Trace:
    >
    > [UnauthorizedAccessException: Access is denied.]
    > System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32
    > errorCode, IntPtr errorInfo) +0
    > System.EnterpriseServices.Thunk.Proxy.CoCreateObje ct(Type serverType,
    > Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581
    >
    >
    System.EnterpriseServices.ServicedComponentProxyAt tribute.CreateInstance(Typ
    e
    > serverType) +181
    >
    >
    System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Typ
    e
    > serverType, Object[] props, Boolean bNewObj) +74
    > DPAPIWeb.WebForm1.btnEncrypt_Click(Object sender, EventArgs e) in
    > c:\documents and settings\bill
    > heckle\vswebcache\billfun\dpapiweb\webform1.aspx.c s:61
    > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    >
    >
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
    stBackEvent(String eventArgument) +57
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    > sourceControl, String eventArgument) +18
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
    > System.Web.UI.Page.ProcessRequestMain() +1277
    >
    >
    >
    >

    Paul Glavich [MVP - ASP.NET] Guest

  4. #3

    Default Re: DPAPI Enterprise Services Example

    Sorry, correction to my last post, the path to the directory is :-
    \Documents and Settings\All Users\Application Data\Microsoft\Crypto

    or even just

    \Documents and Settings\All Users\Application
    Data\Microsoft\Crypto\RSA\MachineKeys

    I think may do the trick.

    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "Paul Glavich [MVP - ASP.NET]" <glav@aspalliance.com-NOSPAM> wrote in
    message news:echdn5ciEHA.3428@TK2MSFTNGP11.phx.gbl...
    > Looks like you are using a ServicedComponent in COM+? That may complicate
    > things a little but you may need to give read/write access to whichever
    user
    > you are running under (might be ASPNET, NETWORK SERVICE, or the defined
    > identity in COM+) to your "\Document And
    > Settings\{user}\ApplicationData\Crypto" directory.
    >
    > --
    > - Paul Glavich
    > Microsoft MVP - ASP.NET
    >
    >
    > "Bill Heckle" <billheckle.spam@hotmail.com> wrote in message
    > news:D0CD2FDF-F29C-46E4-955A-5665AFE9603A@microsoft.com...
    > > I am trying to work through the sample from msdn, "How To Use DPAPI
    (User
    > > Store) from ASP.NET with Enterprise Services". I thought I had
    everything
    > > configured correctly. I tried to test the service and get the following
    > > error.(Sorry for encluding every line). I am confused as to what setting
    > is
    > > incorrectly set. Additionally, the paragraph on giving asp.net access
    > doesn't
    > > help me at all. Thanks for help, as I don't want to keep thrashing
    about.
    > Any
    > > advice on where to read more about security in general is appreciated.
    > >
    > > Exception Details: System.UnauthorizedAccessException: Access is denied.
    > > ASP.NET is not authorized to access the requested resource. Consider
    > > granting access rights to the resource to the ASP.NET request identity.
    > > ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
    > or
    > > Network Service on IIS 6) that is used if the application is not
    > > impersonating. If the application is impersonating via <identity
    > > impersonate="true"/>, the identity will be the anonymous user (typically
    > > IUSR_MACHINENAME) or the authenticated request user.
    > >
    > > To grant ASP.NET write access to a file, right-click the file in
    Explorer,
    > > choose "Properties" and select the Security tab. Click "Add" to add the
    > > appropriate user or group. Highlight the ASP.NET account, and check the
    > boxes
    > > for the desired access.
    > >
    > > Source Error:
    > > Line 59: private void btnEncrypt_Click(object sender, System.EventArgs
    e)
    > > Line 60: {
    > > Line 61: DataProtectorComp dp = new DataProtectorComp();
    > > Line 62: try
    > > Line 63: {
    > >
    > > Source File: c:\documents and
    > > settings\bill\vswebcache\billfun\dpapiweb\webform1 .aspx.cs Line: 61
    > >
    > > Stack Trace:
    > >
    > > [UnauthorizedAccessException: Access is denied.]
    > > System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32
    > > errorCode, IntPtr errorInfo) +0
    > > System.EnterpriseServices.Thunk.Proxy.CoCreateObje ct(Type serverType,
    > > Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581
    > >
    > >
    >
    System.EnterpriseServices.ServicedComponentProxyAt tribute.CreateInstance(Typ
    > e
    > > serverType) +181
    > >
    > >
    >
    System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Typ
    > e
    > > serverType, Object[] props, Boolean bNewObj) +74
    > > DPAPIWeb.WebForm1.btnEncrypt_Click(Object sender, EventArgs e) in
    > > c:\documents and settings\bill
    > > heckle\vswebcache\billfun\dpapiweb\webform1.aspx.c s:61
    > > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    > >
    > >
    >
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
    > stBackEvent(String eventArgument) +57
    > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    > > sourceControl, String eventArgument) +18
    > > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
    +33
    > > System.Web.UI.Page.ProcessRequestMain() +1277
    > >
    > >
    > >
    > >
    >
    >

    Paul Glavich [MVP - ASP.NET] Guest

  5. #4

    Default Re: DPAPI Enterprise Services Example

    Paul,

    Thank you very much for responding. I tried changing the account that Com+
    used to activate the component. I switched it to my development account. I
    got a new error saying that the registry
    key,HKEY_CLASSES_ROOT\DPAPIComp.DataProtectorComp, could not be accessed. I
    looked at the permissions for the key and believe every account that matters
    has access. Obviously, I am wrong. Any thoughts would be helpful. Currently
    the following account and roles have access.
    Administrators,Application Test Center,aspnet_wp account(ASPNET),my
    development account,OWNER,DPAPIAccount(my original com+ activation account),
    local service,service,network,power users,system and users

    Thanks.

    "Paul Glavich [MVP - ASP.NET]" wrote:
    > Sorry, correction to my last post, the path to the directory is :-
    > \Documents and Settings\All Users\Application Data\Microsoft\Crypto
    >
    > or even just
    >
    > \Documents and Settings\All Users\Application
    > Data\Microsoft\Crypto\RSA\MachineKeys
    >
    > I think may do the trick.
    >
    > --
    > - Paul Glavich
    > Microsoft MVP - ASP.NET
    >
    >
    > "Paul Glavich [MVP - ASP.NET]" <glav@aspalliance.com-NOSPAM> wrote in
    > message news:echdn5ciEHA.3428@TK2MSFTNGP11.phx.gbl...
    > > Looks like you are using a ServicedComponent in COM+? That may complicate
    > > things a little but you may need to give read/write access to whichever
    > user
    > > you are running under (might be ASPNET, NETWORK SERVICE, or the defined
    > > identity in COM+) to your "\Document And
    > > Settings\{user}\ApplicationData\Crypto" directory.
    > >
    > > --
    > > - Paul Glavich
    > > Microsoft MVP - ASP.NET
    > >
    > >
    > > "Bill Heckle" <billheckle.spam@hotmail.com> wrote in message
    > > news:D0CD2FDF-F29C-46E4-955A-5665AFE9603A@microsoft.com...
    > > > I am trying to work through the sample from msdn, "How To Use DPAPI
    > (User
    > > > Store) from ASP.NET with Enterprise Services". I thought I had
    > everything
    > > > configured correctly. I tried to test the service and get the following
    > > > error.(Sorry for encluding every line). I am confused as to what setting
    > > is
    > > > incorrectly set. Additionally, the paragraph on giving asp.net access
    > > doesn't
    > > > help me at all. Thanks for help, as I don't want to keep thrashing
    > about.
    > > Any
    > > > advice on where to read more about security in general is appreciated.
    > > >
    > > > Exception Details: System.UnauthorizedAccessException: Access is denied.
    > > > ASP.NET is not authorized to access the requested resource. Consider
    > > > granting access rights to the resource to the ASP.NET request identity.
    > > > ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
    > > or
    > > > Network Service on IIS 6) that is used if the application is not
    > > > impersonating. If the application is impersonating via <identity
    > > > impersonate="true"/>, the identity will be the anonymous user (typically
    > > > IUSR_MACHINENAME) or the authenticated request user.
    > > >
    > > > To grant ASP.NET write access to a file, right-click the file in
    > Explorer,
    > > > choose "Properties" and select the Security tab. Click "Add" to add the
    > > > appropriate user or group. Highlight the ASP.NET account, and check the
    > > boxes
    > > > for the desired access.
    > > >
    > > > Source Error:
    > > > Line 59: private void btnEncrypt_Click(object sender, System.EventArgs
    > e)
    > > > Line 60: {
    > > > Line 61: DataProtectorComp dp = new DataProtectorComp();
    > > > Line 62: try
    > > > Line 63: {
    > > >
    > > > Source File: c:\documents and
    > > > settings\bill\vswebcache\billfun\dpapiweb\webform1 .aspx.cs Line: 61
    > > >
    > > > Stack Trace:
    > > >
    > > > [UnauthorizedAccessException: Access is denied.]
    > > > System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32
    > > > errorCode, IntPtr errorInfo) +0
    > > > System.EnterpriseServices.Thunk.Proxy.CoCreateObje ct(Type serverType,
    > > > Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581
    > > >
    > > >
    > >
    > System.EnterpriseServices.ServicedComponentProxyAt tribute.CreateInstance(Typ
    > > e
    > > > serverType) +181
    > > >
    > > >
    > >
    > System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Typ
    > > e
    > > > serverType, Object[] props, Boolean bNewObj) +74
    > > > DPAPIWeb.WebForm1.btnEncrypt_Click(Object sender, EventArgs e) in
    > > > c:\documents and settings\bill
    > > > heckle\vswebcache\billfun\dpapiweb\webform1.aspx.c s:61
    > > > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    > > >
    > > >
    > >
    > System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
    > > stBackEvent(String eventArgument) +57
    > > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    > > > sourceControl, String eventArgument) +18
    > > > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
    > +33
    > > > System.Web.UI.Page.ProcessRequestMain() +1277
    > > >
    > > >
    > > >
    > > >
    > >
    > >
    >
    >
    >
    Bill Heckle Guest

  6. #5

    Default Re: DPAPI Enterprise Services Example

    Just as a test, try giving Internet applications "Full Trust" via the
    machine policy in .Net framework configuration. (Start --> Control Panel -->
    Administrative Tools --> .Net framework config then Expand 'Runtime
    Security Policy' --> Machine --> Code Groups -> All Code --> Internet
    Zone --> Right click --> Properties --> Go to permissions set tab, select
    Full trust). By default, ASP.NET web apps only have limited access via this
    policy and certainly dont have "interop" permissions. It looks as though you
    might be getting denied access when trying to do interop.

    --
    - Paul Glavich
    Microsoft MVP - ASP.NET


    "Bill Heckle" <billheckle.spam@hotmail.com> wrote in message
    news:3696AF0E-FCD5-47AE-835D-19016D9D1BD8@microsoft.com...
    > Paul,
    >
    > Thank you very much for responding. I tried changing the account that
    Com+
    > used to activate the component. I switched it to my development account. I
    > got a new error saying that the registry
    > key,HKEY_CLASSES_ROOT\DPAPIComp.DataProtectorComp, could not be accessed.
    I
    > looked at the permissions for the key and believe every account that
    matters
    > has access. Obviously, I am wrong. Any thoughts would be helpful.
    Currently
    > the following account and roles have access.
    > Administrators,Application Test Center,aspnet_wp account(ASPNET),my
    > development account,OWNER,DPAPIAccount(my original com+ activation
    account),
    > local service,service,network,power users,system and users
    >
    > Thanks.
    >
    > "Paul Glavich [MVP - ASP.NET]" wrote:
    >
    > > Sorry, correction to my last post, the path to the directory is :-
    > > \Documents and Settings\All Users\Application Data\Microsoft\Crypto
    > >
    > > or even just
    > >
    > > \Documents and Settings\All Users\Application
    > > Data\Microsoft\Crypto\RSA\MachineKeys
    > >
    > > I think may do the trick.
    > >
    > > --
    > > - Paul Glavich
    > > Microsoft MVP - ASP.NET
    > >
    > >
    > > "Paul Glavich [MVP - ASP.NET]" <glav@aspalliance.com-NOSPAM> wrote in
    > > message news:echdn5ciEHA.3428@TK2MSFTNGP11.phx.gbl...
    > > > Looks like you are using a ServicedComponent in COM+? That may
    complicate
    > > > things a little but you may need to give read/write access to
    whichever
    > > user
    > > > you are running under (might be ASPNET, NETWORK SERVICE, or the
    defined
    > > > identity in COM+) to your "\Document And
    > > > Settings\{user}\ApplicationData\Crypto" directory.
    > > >
    > > > --
    > > > - Paul Glavich
    > > > Microsoft MVP - ASP.NET
    > > >
    > > >
    > > > "Bill Heckle" <billheckle.spam@hotmail.com> wrote in message
    > > > news:D0CD2FDF-F29C-46E4-955A-5665AFE9603A@microsoft.com...
    > > > > I am trying to work through the sample from msdn, "How To Use DPAPI
    > > (User
    > > > > Store) from ASP.NET with Enterprise Services". I thought I had
    > > everything
    > > > > configured correctly. I tried to test the service and get the
    following
    > > > > error.(Sorry for encluding every line). I am confused as to what
    setting
    > > > is
    > > > > incorrectly set. Additionally, the paragraph on giving asp.net
    access
    > > > doesn't
    > > > > help me at all. Thanks for help, as I don't want to keep thrashing
    > > about.
    > > > Any
    > > > > advice on where to read more about security in general is
    appreciated.
    > > > >
    > > > > Exception Details: System.UnauthorizedAccessException: Access is
    denied.
    > > > > ASP.NET is not authorized to access the requested resource. Consider
    > > > > granting access rights to the resource to the ASP.NET request
    identity.
    > > > > ASP.NET has a base process identity (typically {MACHINE}\ASPNET on
    IIS 5
    > > > or
    > > > > Network Service on IIS 6) that is used if the application is not
    > > > > impersonating. If the application is impersonating via <identity
    > > > > impersonate="true"/>, the identity will be the anonymous user
    (typically
    > > > > IUSR_MACHINENAME) or the authenticated request user.
    > > > >
    > > > > To grant ASP.NET write access to a file, right-click the file in
    > > Explorer,
    > > > > choose "Properties" and select the Security tab. Click "Add" to add
    the
    > > > > appropriate user or group. Highlight the ASP.NET account, and check
    the
    > > > boxes
    > > > > for the desired access.
    > > > >
    > > > > Source Error:
    > > > > Line 59: private void btnEncrypt_Click(object sender,
    System.EventArgs
    > > e)
    > > > > Line 60: {
    > > > > Line 61: DataProtectorComp dp = new DataProtectorComp();
    > > > > Line 62: try
    > > > > Line 63: {
    > > > >
    > > > > Source File: c:\documents and
    > > > > settings\bill\vswebcache\billfun\dpapiweb\webform1 .aspx.cs Line:
    61
    > > > >
    > > > > Stack Trace:
    > > > >
    > > > > [UnauthorizedAccessException: Access is denied.]
    > > > > System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32
    > > > > errorCode, IntPtr errorInfo) +0
    > > > > System.EnterpriseServices.Thunk.Proxy.CoCreateObje ct(Type
    serverType,
    > > > > Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581
    > > > >
    > > > >
    > > >
    > >
    System.EnterpriseServices.ServicedComponentProxyAt tribute.CreateInstance(Typ
    > > > e
    > > > > serverType) +181
    > > > >
    > > > >
    > > >
    > >
    System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Typ
    > > > e
    > > > > serverType, Object[] props, Boolean bNewObj) +74
    > > > > DPAPIWeb.WebForm1.btnEncrypt_Click(Object sender, EventArgs e) in
    > > > > c:\documents and settings\bill
    > > > > heckle\vswebcache\billfun\dpapiweb\webform1.aspx.c s:61
    > > > > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    > > > >
    > > > >
    > > >
    > >
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
    > > > stBackEvent(String eventArgument) +57
    > > > > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    > > > > sourceControl, String eventArgument) +18
    > > > > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection
    postData)
    > > +33
    > > > > System.Web.UI.Page.ProcessRequestMain() +1277
    > > > >
    > > > >
    > > > >
    > > > >
    > > >
    > > >
    > >
    > >
    > >

    Paul Glavich [MVP - ASP.NET] Guest

  7. #6

    Default Re: DPAPI Enterprise Services Example

    Hi Bill,

    I'm going through the same process, but am stuck at trying to start the
    service - I get error 5: access is denied.

    The local account I configured for this has Log on as batch job and log on
    locally rights.

    The service starts ok if I make the account a member of adminstrators, so
    that rules out code errors.

    Do you have any tips for me on this?

    Thanks in advance
    Martin

    "Bill Heckle" <billheckle.spam@hotmail.com> wrote in message
    news:D0CD2FDF-F29C-46E4-955A-5665AFE9603A@microsoft.com...
    > I am trying to work through the sample from msdn, "How To Use DPAPI (User
    > Store) from ASP.NET with Enterprise Services". I thought I had everything
    > configured correctly. I tried to test the service and get the following
    > error.(Sorry for encluding every line). I am confused as to what setting
    is
    > incorrectly set. Additionally, the paragraph on giving asp.net access
    doesn't
    > help me at all. Thanks for help, as I don't want to keep thrashing about.
    Any
    > advice on where to read more about security in general is appreciated.
    >
    > Exception Details: System.UnauthorizedAccessException: Access is denied.
    > ASP.NET is not authorized to access the requested resource. Consider
    > granting access rights to the resource to the ASP.NET request identity.
    > ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5
    or
    > Network Service on IIS 6) that is used if the application is not
    > impersonating. If the application is impersonating via <identity
    > impersonate="true"/>, the identity will be the anonymous user (typically
    > IUSR_MACHINENAME) or the authenticated request user.
    >
    > To grant ASP.NET write access to a file, right-click the file in Explorer,
    > choose "Properties" and select the Security tab. Click "Add" to add the
    > appropriate user or group. Highlight the ASP.NET account, and check the
    boxes
    > for the desired access.
    >
    > Source Error:
    > Line 59: private void btnEncrypt_Click(object sender, System.EventArgs e)
    > Line 60: {
    > Line 61: DataProtectorComp dp = new DataProtectorComp();
    > Line 62: try
    > Line 63: {
    >
    > Source File: c:\documents and
    > settings\bill\vswebcache\billfun\dpapiweb\webform1 .aspx.cs Line: 61
    >
    > Stack Trace:
    >
    > [UnauthorizedAccessException: Access is denied.]
    > System.Runtime.InteropServices.Marshal.ThrowExcept ionForHR(Int32
    > errorCode, IntPtr errorInfo) +0
    > System.EnterpriseServices.Thunk.Proxy.CoCreateObje ct(Type serverType,
    > Boolean bQuerySCInfo, Boolean& bIsAnotherProcess, String& uri) +581
    >
    >
    System.EnterpriseServices.ServicedComponentProxyAt tribute.CreateInstance(Typ
    e
    > serverType) +181
    >
    >
    System.Runtime.Remoting.Activation.ActivationServi ces.IsCurrentContextOK(Typ
    e
    > serverType, Object[] props, Boolean bNewObj) +74
    > DPAPIWeb.WebForm1.btnEncrypt_Click(Object sender, EventArgs e) in
    > c:\documents and settings\bill
    > heckle\vswebcache\billfun\dpapiweb\webform1.aspx.c s:61
    > System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
    >
    >
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
    stBackEvent(String eventArgument) +57
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    > sourceControl, String eventArgument) +18
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +33
    > System.Web.UI.Page.ProcessRequestMain() +1277
    >
    >
    >
    >

    Martin 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