Illegal to mix Authentication methods ?

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

  1. #1

    Default Illegal to mix Authentication methods ?

    Hello,

    I have a Web Service, a Winform client and a web Application. The Web App and the WinForm Client use the same Web Service (or such is the plan).

    The WinForm Client and the Webservice work together using Integrated Windows Authentication and works well.

    The nature of the Web App, compels me to use Forms authentication. The default page redirects to the login page for the login. The login screen access the Web Service through the proxy generated by WSDL.exe.

    The intent is to only allow authenticated windows users to reach the Login screen in the first place. After the login screen, access to the App pages will be via cookie authentication. Each of the web pages access the Web Service (through the proxy). Anonymous access is turned off. Where authentication can be specified in the App path through IIS, it has been set to Integrated Windows.

    The code :

    Line 42: pss = FormsAuthentication.HashPasswordForStoringInConfig File(txtPss.Text, "sha1")
    Line 43:
    Line 44: If proxy.ValidateUser(txtUser.Text, pss) Then <-----------The bad line

    Line 45: FormsAuthentication.RedirectFromLoginPage(txtUser. Text, False)
    Line 46: Else


    The returned exception is below.


    WebException: The request failed with HTTP status 401: Access Denied.]
    System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
    System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String methodName, Object[] parameters)
    MABillingService.ValidateUser(String UserId, String psswd)
    _3rdPartyWeb.login.btnLogin_Click(Object sender, EventArgs e) in c:\inetpub\wwwroot\3rdPartyWeb\login.aspx.vb:44
    System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
    System.Web.UI.Page.ProcessRequestMain()

    Must I set authentication to Anonymous if I am using Forms? Can one client use Integrated Windows with a web service while another uses Forms through the proxy for the same service?

    I have read a lot, but everything is spread all over the place and little of it is tied together.

    mklapp Guest

  2. Similar Questions and Discussions

    1. Illegal Name
      What is see is CFIF NOT IsDefined ("SESSION.ahh")> CFLOCK scope="session" throwontimeout="no" timeout="10"
    2. Authentication methods...
      Hi, We're likelly to have both internal and external systems on our servers. We've only got one IIS server (Charity!). Is there going to be...
    3. #26350 [NEW]: Inherited methods can't access private methods
      From: forseti at oak dot rpg dot pl Operating system: Windows 98 SE PHP version: 5.0.0b2 (beta2) PHP Bug Type: Zend Engine 2...
    4. Really confused about authorization/authentication methods in ASP.Net
      I have been reading and reading the Microsoft best practices, articles on and on but still I can't figure out which method to chose to get started....
    5. Aliased setter methods behave differently than other methods?
      Here's another question... I am aliasing and redefining certain methods, determined at runtime. Normal methods work fine, but methods ending in '='...
  3. #2

    Default Re: Illegal to mix Authentication methods ?

    I think this article will shed some light on the subject.
    [url]http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/ht[/url]
    ml/mixedsecurity.asp


    "mklapp" <mklapp@zippy.com> escribió en el mensaje
    news:05F96181-74C4-4175-A374-73F244AB80B2@microsoft.com...
    > Hello,
    >
    > I have a Web Service, a Winform client and a web Application. The Web
    App and the WinForm Client use the same Web Service (or such is the plan).
    >
    > The WinForm Client and the Webservice work together using Integrated
    Windows Authentication and works well.
    >
    > The nature of the Web App, compels me to use Forms authentication. The
    default page redirects to the login page for the login. The login screen
    access the Web Service through the proxy generated by WSDL.exe.
    >
    > The intent is to only allow authenticated windows users to reach the
    Login screen in the first place. After the login screen, access to the App
    pages will be via cookie authentication. Each of the web pages access the
    Web Service (through the proxy). Anonymous access is turned off. Where
    authentication can be specified in the App path through IIS, it has been set
    to Integrated Windows.
    >
    > The code :
    >
    > Line 42: pss =
    FormsAuthentication.HashPasswordForStoringInConfig File(txtPss.Text, "sha1")
    > Line 43:
    > Line 44: If proxy.ValidateUser(txtUser.Text, pss) Then
    <-----------The bad line
    >
    > Line 45:
    FormsAuthentication.RedirectFromLoginPage(txtUser. Text, False)
    > Line 46: Else
    >
    >
    > The returned exception is below.
    >
    >
    > WebException: The request failed with HTTP status 401: Access Denied.]
    >
    System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClient
    Message message, WebResponse response, Stream responseStream, Boolean
    asyncCall)
    > System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
    methodName, Object[] parameters)
    > MABillingService.ValidateUser(String UserId, String psswd)
    > _3rdPartyWeb.login.btnLogin_Click(Object sender, EventArgs e) in
    c:\inetpub\wwwroot\3rdPartyWeb\login.aspx.vb:44
    > System.Web.UI.WebControls.Button.OnClick(EventArgs e)
    >
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePo
    stBackEvent(String eventArgument)
    > System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
    sourceControl, String eventArgument)
    > System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
    > System.Web.UI.Page.ProcessRequestMain()
    >
    > Must I set authentication to Anonymous if I am using Forms? Can one
    client use Integrated Windows with a web service while another uses Forms
    through the proxy for the same service?
    >
    > I have read a lot, but everything is spread all over the place and
    little of it is tied together.
    >

    Hernan de Lahitte Guest

  4. #3

    Default RE: Illegal to mix Authentication methods ?

    Hi Mklapp,

    Thank you for posting in community. I'm reviewing this issue and found that
    this thread seems a duplicated one with another one whose subject is:
    "what loads proxies?"
    in ASP.NET queue. I've replied you in that thread. Please check out my
    suggestions there to see whether they'll be helpful. Also, I think the tech
    article Hernan has provided is also very informative, you may have a look
    at it.
    If you feel anything unclear or if my suggestion there is not quite
    suitable for you, please feel free to let me know.


    Regards,

    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)

    Steven Cheng[MSFT] Guest

  5. #4

    Default RE: Illegal to mix Authentication methods ?

    When you access the Web service from the WinForm app, I expect you have set
    the credential property on the proxy.
    proxy.Credentials = myCache

    [C#]
    wReq.Credentials = CredentialCache.DefaultCredential;
    [Visual Basic]
    wReq.Credentials CredentialCache.DefaultCredential


    I don't see you have done the same thing in the ASP.NET Web app. How do you
    handle the authentication between ASPX and the Web service?
    Are they on the same machine?

    Thanks,
    David
    Microsoft Developer Support

    David Qiu Guest

  6. #5

    Default RE: Illegal to mix Authentication methods ?

    The authentication strategy here is an evolving thing. I am only configuring Authentication between the App and (I guess) IIS. The web service is for both internal use by a WinForm client and external use by a Web App. Authentication is implemented by both as a user login. This prevents unauthorized users from using the apps to access the Web Service. The nature of a web service, of course, let's any app negotiate the service through a published interface.

    It is my intent not to publish the interface. Granted my intent may be frustrated by the nature of the beast. The same high level of abstraction that makes it possible to do so much so quickly, also could set up functionality I do not know about. The directory holding the web service is planned to disallow anonymous access. Beyond that the strategy will be determined by what is possible and necessary.
    mklapp Guest

  7. #6

    Default RE: Illegal to mix Authentication methods ?

    When you access the Web service from the WinForm app, I expect you have set
    the credential property on the proxy.
    proxy.Credentials = myCache

    [C#]
    wReq.Credentials = CredentialCache.DefaultCredential;
    [Visual Basic]
    wReq.Credentials CredentialCache.DefaultCredential

    I don't see you have done the same thing in the ASP.NET Web app. How do you
    handle the authentication between ASPX and the Web service?
    Are they on the same machine?

    Thanks,
    David
    Microsoft Developer Support

    David Qiu Guest

  8. #7

    Default RE: Illegal to mix Authentication methods ?

    I am sorry I don't quite understand your problem. What is the
    authentication setting of the Web service in IIS? How do you invoke the Web
    service method from the aspx page? The 401 error comes from IIS. Can you
    use the same code to call the Web service from another aspx page that
    doesn't use Form auth?

    David
    Microsoft Developer Support
    Distributed Services

    David Qiu 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