IIS and HttpListener (.NET) with windows authentication












1















I have a question about windows authentication with IIS and HttpListner



I have following setup (All installed in same windows 8.1 box. No outside communication). All requests are sent as http://localhost/......



IIS



ASP.Net web application authentication



Anonymous: Disabled 
Windows Authentication: Enabled


.Net httpListener



running as a Service run as local System Account. and enabled windows authentication



this.httpListener = new HttpListener();
this.httpListener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;


UWP Application (Windows 8.1)



UWP Application is just like a web browser. It has WebView control to see web contents.



Following capabilities enabled




  • Enterprise Authentication

  • Internet (Client)

  • Location

  • Private Networks (Client & Server)


Problem



When I navigate from the uwp app to the IIS web app it is asking for the credentials by popping up windows dialog. This is annoying for the user experience perspective because user is logged in with same credencials. But When I access Http Listener it is authenticate correctly and no credentials dialog.



Also I checked the requests through fiddler. Initial request is identical, but with next steps for IIS request, it is continuously asking for NTLM.



HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.5
WWW-Authenticate: Negotiate oYHOMIHLoAMKAQGhDAYKKwYBBAGCNwICC........
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET


Initial Request/Response



IIS



Request



GET http://localhost/webapp_net/ HTTP/1.1
Accept-Encoding: gzip, deflate
Host: localhost
Connection: Keep-Alive


Response



HTTP/1.1 401 Unauthorized
Cache-Control: private
Content-Type: text/html; charset=utf-8
Server: Microsoft-IIS/8.5
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
X-Powered-By: ASP.NET
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET,POST
Date: Tue, 20 Nov 2018 21:37:24 GMT
Content-Length: 6016
Proxy-Support: Session-Based-Authentication


HttpListener



Request



GET http://localhost/appman HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: en-NZ
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; WebView/2.0; rv:11.0) like Gecko
Accept-Encoding: gzip, deflate
Connection: Keep-Alive
Host: localhost


Response



HTTP/1.1 401 Unauthorized
Content-Length: 0
Server: Microsoft-HTTPAPI/2.0
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Date: Tue, 20 Nov 2018 21:37:18 GMT
Proxy-Support: Session-Based-Authentication


Does anyone have similar experience or explanation for this ?










share|improve this question





























    1















    I have a question about windows authentication with IIS and HttpListner



    I have following setup (All installed in same windows 8.1 box. No outside communication). All requests are sent as http://localhost/......



    IIS



    ASP.Net web application authentication



    Anonymous: Disabled 
    Windows Authentication: Enabled


    .Net httpListener



    running as a Service run as local System Account. and enabled windows authentication



    this.httpListener = new HttpListener();
    this.httpListener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;


    UWP Application (Windows 8.1)



    UWP Application is just like a web browser. It has WebView control to see web contents.



    Following capabilities enabled




    • Enterprise Authentication

    • Internet (Client)

    • Location

    • Private Networks (Client & Server)


    Problem



    When I navigate from the uwp app to the IIS web app it is asking for the credentials by popping up windows dialog. This is annoying for the user experience perspective because user is logged in with same credencials. But When I access Http Listener it is authenticate correctly and no credentials dialog.



    Also I checked the requests through fiddler. Initial request is identical, but with next steps for IIS request, it is continuously asking for NTLM.



    HTTP/1.1 401 Unauthorized
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Server: Microsoft-IIS/8.5
    WWW-Authenticate: Negotiate oYHOMIHLoAMKAQGhDAYKKwYBBAGCNwICC........
    WWW-Authenticate: NTLM
    X-Powered-By: ASP.NET


    Initial Request/Response



    IIS



    Request



    GET http://localhost/webapp_net/ HTTP/1.1
    Accept-Encoding: gzip, deflate
    Host: localhost
    Connection: Keep-Alive


    Response



    HTTP/1.1 401 Unauthorized
    Cache-Control: private
    Content-Type: text/html; charset=utf-8
    Server: Microsoft-IIS/8.5
    WWW-Authenticate: Negotiate
    WWW-Authenticate: NTLM
    X-Powered-By: ASP.NET
    Access-Control-Allow-Origin: *
    Access-Control-Allow-Methods: GET,POST
    Date: Tue, 20 Nov 2018 21:37:24 GMT
    Content-Length: 6016
    Proxy-Support: Session-Based-Authentication


    HttpListener



    Request



    GET http://localhost/appman HTTP/1.1
    Accept: text/html, application/xhtml+xml, */*
    Accept-Language: en-NZ
    User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; WebView/2.0; rv:11.0) like Gecko
    Accept-Encoding: gzip, deflate
    Connection: Keep-Alive
    Host: localhost


    Response



    HTTP/1.1 401 Unauthorized
    Content-Length: 0
    Server: Microsoft-HTTPAPI/2.0
    WWW-Authenticate: Negotiate
    WWW-Authenticate: NTLM
    Date: Tue, 20 Nov 2018 21:37:18 GMT
    Proxy-Support: Session-Based-Authentication


    Does anyone have similar experience or explanation for this ?










    share|improve this question



























      1












      1








      1








      I have a question about windows authentication with IIS and HttpListner



      I have following setup (All installed in same windows 8.1 box. No outside communication). All requests are sent as http://localhost/......



      IIS



      ASP.Net web application authentication



      Anonymous: Disabled 
      Windows Authentication: Enabled


      .Net httpListener



      running as a Service run as local System Account. and enabled windows authentication



      this.httpListener = new HttpListener();
      this.httpListener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;


      UWP Application (Windows 8.1)



      UWP Application is just like a web browser. It has WebView control to see web contents.



      Following capabilities enabled




      • Enterprise Authentication

      • Internet (Client)

      • Location

      • Private Networks (Client & Server)


      Problem



      When I navigate from the uwp app to the IIS web app it is asking for the credentials by popping up windows dialog. This is annoying for the user experience perspective because user is logged in with same credencials. But When I access Http Listener it is authenticate correctly and no credentials dialog.



      Also I checked the requests through fiddler. Initial request is identical, but with next steps for IIS request, it is continuously asking for NTLM.



      HTTP/1.1 401 Unauthorized
      Cache-Control: private
      Content-Type: text/html; charset=utf-8
      Server: Microsoft-IIS/8.5
      WWW-Authenticate: Negotiate oYHOMIHLoAMKAQGhDAYKKwYBBAGCNwICC........
      WWW-Authenticate: NTLM
      X-Powered-By: ASP.NET


      Initial Request/Response



      IIS



      Request



      GET http://localhost/webapp_net/ HTTP/1.1
      Accept-Encoding: gzip, deflate
      Host: localhost
      Connection: Keep-Alive


      Response



      HTTP/1.1 401 Unauthorized
      Cache-Control: private
      Content-Type: text/html; charset=utf-8
      Server: Microsoft-IIS/8.5
      WWW-Authenticate: Negotiate
      WWW-Authenticate: NTLM
      X-Powered-By: ASP.NET
      Access-Control-Allow-Origin: *
      Access-Control-Allow-Methods: GET,POST
      Date: Tue, 20 Nov 2018 21:37:24 GMT
      Content-Length: 6016
      Proxy-Support: Session-Based-Authentication


      HttpListener



      Request



      GET http://localhost/appman HTTP/1.1
      Accept: text/html, application/xhtml+xml, */*
      Accept-Language: en-NZ
      User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; WebView/2.0; rv:11.0) like Gecko
      Accept-Encoding: gzip, deflate
      Connection: Keep-Alive
      Host: localhost


      Response



      HTTP/1.1 401 Unauthorized
      Content-Length: 0
      Server: Microsoft-HTTPAPI/2.0
      WWW-Authenticate: Negotiate
      WWW-Authenticate: NTLM
      Date: Tue, 20 Nov 2018 21:37:18 GMT
      Proxy-Support: Session-Based-Authentication


      Does anyone have similar experience or explanation for this ?










      share|improve this question
















      I have a question about windows authentication with IIS and HttpListner



      I have following setup (All installed in same windows 8.1 box. No outside communication). All requests are sent as http://localhost/......



      IIS



      ASP.Net web application authentication



      Anonymous: Disabled 
      Windows Authentication: Enabled


      .Net httpListener



      running as a Service run as local System Account. and enabled windows authentication



      this.httpListener = new HttpListener();
      this.httpListener.AuthenticationSchemes = AuthenticationSchemes.IntegratedWindowsAuthentication;


      UWP Application (Windows 8.1)



      UWP Application is just like a web browser. It has WebView control to see web contents.



      Following capabilities enabled




      • Enterprise Authentication

      • Internet (Client)

      • Location

      • Private Networks (Client & Server)


      Problem



      When I navigate from the uwp app to the IIS web app it is asking for the credentials by popping up windows dialog. This is annoying for the user experience perspective because user is logged in with same credencials. But When I access Http Listener it is authenticate correctly and no credentials dialog.



      Also I checked the requests through fiddler. Initial request is identical, but with next steps for IIS request, it is continuously asking for NTLM.



      HTTP/1.1 401 Unauthorized
      Cache-Control: private
      Content-Type: text/html; charset=utf-8
      Server: Microsoft-IIS/8.5
      WWW-Authenticate: Negotiate oYHOMIHLoAMKAQGhDAYKKwYBBAGCNwICC........
      WWW-Authenticate: NTLM
      X-Powered-By: ASP.NET


      Initial Request/Response



      IIS



      Request



      GET http://localhost/webapp_net/ HTTP/1.1
      Accept-Encoding: gzip, deflate
      Host: localhost
      Connection: Keep-Alive


      Response



      HTTP/1.1 401 Unauthorized
      Cache-Control: private
      Content-Type: text/html; charset=utf-8
      Server: Microsoft-IIS/8.5
      WWW-Authenticate: Negotiate
      WWW-Authenticate: NTLM
      X-Powered-By: ASP.NET
      Access-Control-Allow-Origin: *
      Access-Control-Allow-Methods: GET,POST
      Date: Tue, 20 Nov 2018 21:37:24 GMT
      Content-Length: 6016
      Proxy-Support: Session-Based-Authentication


      HttpListener



      Request



      GET http://localhost/appman HTTP/1.1
      Accept: text/html, application/xhtml+xml, */*
      Accept-Language: en-NZ
      User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; WebView/2.0; rv:11.0) like Gecko
      Accept-Encoding: gzip, deflate
      Connection: Keep-Alive
      Host: localhost


      Response



      HTTP/1.1 401 Unauthorized
      Content-Length: 0
      Server: Microsoft-HTTPAPI/2.0
      WWW-Authenticate: Negotiate
      WWW-Authenticate: NTLM
      Date: Tue, 20 Nov 2018 21:37:18 GMT
      Proxy-Support: Session-Based-Authentication


      Does anyone have similar experience or explanation for this ?







      windows authentication iis httplistener ntlm-authentication






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 19:37







      DineshNS

















      asked Nov 21 '18 at 1:31









      DineshNSDineshNS

      1,10331124




      1,10331124
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404087%2fiis-and-httplistener-net-with-windows-authentication%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404087%2fiis-and-httplistener-net-with-windows-authentication%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          MongoDB - Not Authorized To Execute Command

          How to fix TextFormField cause rebuild widget in Flutter

          in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith