Windows authentication bug?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?TWFjaHVnYQ==?=

    #1

    Windows authentication bug?

    My web.config contains:
    <authorizatio n>
    <deny users="?" />
    </authorization>

    <authenticati on mode="Windows" />
    <identity impersonate="tr ue" userName="" password="" />

    My connection string in page.aspx.vb contains:

    oSQLConn.Connec tionString = "Data Source=" & Server & "," & PortNo &
    ";Initial Catalog=master; Integrated Security=SSPI;"

    When the connection is opened:
    oSQLConn.Open()

    No matter what I do it always passes anonymous user instead of logged on
    user and fails to open the connection. Only if I edit web.config and supply
    userName & password

    <identity impersonate="tr ue" userName="mynam e" password="mypas sword" />

    then the connection is opened with supplied credentials.

    Is this a bug? Is there a workaround? Am I missing something?
    I'm sure bunch of ppl had to run into this problem. How did you fix it?



    Machuga

  • Mythran

    #2
    Re: Windows authentication bug?



    "Machuga" <Machuga@discus sions.microsoft .comwrote in message
    news:6205F480-601C-457A-966D-98189FD6D7CE@mi crosoft.com...
    My web.config contains:
    <authorizatio n>
    <deny users="?" />
    </authorization>
    >
    <authenticati on mode="Windows" />
    <identity impersonate="tr ue" userName="" password="" />
    >
    My connection string in page.aspx.vb contains:
    >
    oSQLConn.Connec tionString = "Data Source=" & Server & "," & PortNo
    &
    ";Initial Catalog=master; Integrated Security=SSPI;"
    >
    When the connection is opened:
    oSQLConn.Open()
    >
    No matter what I do it always passes anonymous user instead of logged on
    user and fails to open the connection. Only if I edit web.config and
    supply
    userName & password
    >
    <identity impersonate="tr ue" userName="mynam e" password="mypas sword" />
    >
    then the connection is opened with supplied credentials.
    >
    Is this a bug? Is there a workaround? Am I missing something?
    I'm sure bunch of ppl had to run into this problem. How did you fix it?
    >
    >
    >
    Machuga
    >
    In IIS you need to disable anonymous authentication and make sure integrated
    windows authentication is enabled for the virtual directory your application
    resides...

    HTH,
    Mythran

    Comment

    • =?Utf-8?B?TWFjaHVnYQ==?=

      #3
      Re: Windows authentication bug?

      Hi Mythran
      Yes, IIS has anonymous disabled. Wierd thing is that if I set a connection
      string in web.config:

      <connectionStri ngs>
      <add name="BUITConne ctionString" connectionStrin g="Data
      Source=ServerNa me,2048;Initial Catalog=master; Integrated Security=SSPI"
      providerName="S ystem.Data.SqlC lient"/>
      </connectionStrin gs>

      Then it works fine, but a connection from page in code behind does not.

      Thanks for your help
      Machuga




      "Mythran" wrote:
      >
      In IIS you need to disable anonymous authentication and make sure integrated
      windows authentication is enabled for the virtual directory your application
      resides...
      >
      HTH,
      Mythran
      >
      >

      Comment

      • =?Utf-8?B?U2FzaGlkaGFyIEtva2t1?=

        #4
        Re: Windows authentication bug?

        Machuga,
        Try changing the IntegratedSecur ity property to "none" or "false" ... and
        run your code again.

        --
        Sashidhar Kokku
        ikaSystems Corp


        "Machuga" wrote:
        Hi Mythran
        Yes, IIS has anonymous disabled. Wierd thing is that if I set a connection
        string in web.config:
        >
        <connectionStri ngs>
        <add name="BUITConne ctionString" connectionStrin g="Data
        Source=ServerNa me,2048;Initial Catalog=master; Integrated Security=SSPI"
        providerName="S ystem.Data.SqlC lient"/>
        </connectionStrin gs>
        >
        Then it works fine, but a connection from page in code behind does not.
        >
        Thanks for your help
        Machuga
        >
        >
        >
        >
        "Mythran" wrote:

        In IIS you need to disable anonymous authentication and make sure integrated
        windows authentication is enabled for the virtual directory your application
        resides...

        HTH,
        Mythran

        Comment

        • =?Utf-8?B?TWFjaHVnYQ==?=

          #5
          Re: Windows authentication bug?

          Hi Sashidhar,

          Your solution gives an expected error:
          Login failed for user ''. The user is not associated with a trusted SQL
          Server connection.

          Let me make sure that you understand, that I have a connection string to a
          fixed SQL server in web.config that is reading data into a dropdown box
          control when page is loaded (that connection works). Upon selection from
          dropdown box ( that contains over 500 SQL server names) is passed to a
          connection string in code behind page. I have T-SQL code that needs to be
          executed on any of those 500 boxes with credentials of a logged in user. That
          connection is trying to use anonymous user and fails.
          When username and password is supplied in web.config then the connection
          works but it uses a that fixed user from web.config instead of logged in user
          to connect to the sql boxes.


          Thanks for trying
          Mchuga

          "Sashidhar Kokku" wrote:
          Machuga,
          Try changing the IntegratedSecur ity property to "none" or "false" ... and
          run your code again.
          >
          --
          Sashidhar Kokku
          ikaSystems Corp
          >
          >
          "Machuga" wrote:
          >
          Hi Mythran
          Yes, IIS has anonymous disabled. Wierd thing is that if I set a connection
          string in web.config:

          <connectionStri ngs>
          <add name="BUITConne ctionString" connectionStrin g="Data
          Source=ServerNa me,2048;Initial Catalog=master; Integrated Security=SSPI"
          providerName="S ystem.Data.SqlC lient"/>
          </connectionStrin gs>

          Then it works fine, but a connection from page in code behind does not.

          Thanks for your help
          Machuga




          "Mythran" wrote:
          >
          In IIS you need to disable anonymous authentication and make sure integrated
          windows authentication is enabled for the virtual directory your application
          resides...
          >
          HTH,
          Mythran
          >
          >

          Comment

          • =?Utf-8?B?TWFjaHVnYQ==?=

            #6
            Re: Windows authentication bug?

            At this point I'm assuming that this is one of those questions that none of
            th MVPs want's to touch.
            Can anybody point me to the right resource though?
            Anything written in all my smart books or found on the web is inconclusive.

            I appreciate any help

            Thank you
            Machuga

            Comment

            • Juan T. Llibre

              #7
              Re: Windows authentication bug?

              See if the info in this resource helps :

              http://msdn2.microsoft.com/en-us/library/ms998355.aspx

              There's an alternate method at :

              http://msdn2.microsoft.com/en-us/library/ms998358.aspx




              Juan T. Llibre, asp.net MVP
              asp.net faq : http://asp.net.do/faq/
              foros de asp.net, en español : http://asp.net.do/foros/
              =============== =============== =====
              "Machuga" <Machuga@discus sions.microsoft .comwrote in message
              news:5CB55C05-DCF5-44A9-BDB0-F86C5B4F1A18@mi crosoft.com...
              At this point I'm assuming that this is one of those questions that none of
              th MVPs want's to touch.
              Can anybody point me to the right resource though?
              Anything written in all my smart books or found on the web is inconclusive.
              >
              I appreciate any help
              >
              Thank you
              Machuga

              Comment

              • =?Utf-8?B?TWFjaHVnYQ==?=

                #8
                Re: Windows authentication bug?

                Thank you Juan for your post.

                I've been through those links last week. Everything I got setup is in
                accordance with those gudielines.

                I noticed that everything on the box that runs IIS and local SQL instance is
                authenticating fine. It is when IIS is trying to open connection to a remote
                SQL server, thats when authentication is passed as "anonymous" . For some
                reason it will not carry the credentials of logged in user, but tries to
                connect as anonymous.

                I'm not sure is this a bug or is this by design.
                If it is by design then Microsoft is surley hiding resolution for this
                really well, as I have been searching high and low to no avail.

                I just can't picture that I'm the only one that needs IIS app. to connect to
                a remote SQL server using windows authentication.

                Thank you
                Machuga





                "Juan T. Llibre" wrote:
                See if the info in this resource helps :
                >
                http://msdn2.microsoft.com/en-us/library/ms998355.aspx
                >
                There's an alternate method at :
                >
                http://msdn2.microsoft.com/en-us/library/ms998358.aspx
                >
                >
                >
                >
                Juan T. Llibre, asp.net MVP
                asp.net faq : http://asp.net.do/faq/
                foros de asp.net, en español : http://asp.net.do/foros/
                =============== =============== =====
                "Machuga" <Machuga@discus sions.microsoft .comwrote in message
                news:5CB55C05-DCF5-44A9-BDB0-F86C5B4F1A18@mi crosoft.com...
                At this point I'm assuming that this is one of those questions that none of
                th MVPs want's to touch.
                Can anybody point me to the right resource though?
                Anything written in all my smart books or found on the web is inconclusive.

                I appreciate any help

                Thank you
                Machuga
                >
                >
                >

                Comment

                Working...