Can't open database in browser control

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

    Can't open database in browser control

    I cannot access my SQL database in a browser control created in my C# Windows
    application program I can, however, access the database from an IE browser.
    I get the ubiquitous "Login failed for NT AUTHORITY\NETWO RK SERVICE" error
    message. I researched all the advice on the internet and tried to add an NT
    AUTHORITY\NETWO RK SERVICE login to my database under the Security/Users tab
    using SQL Server Mangement. However, there is no NT AUTHORITY\NETWO RK SERVICE
    login in my SQL dialog, only an NT AUTHORITY\SYSTE M login. Why is that?
    Secondly, I finally was able to add an NT AUTHORITY\NETWO RK SERVICE manually
    to my database login and gave it all of the permissions but I still get the
    error when accessing the database through my Windows browser control.
    Below is my connection string.

    Provider=SQLOLE DB; Data Source=Vista; Initial Catalog=Mydatab ase;Integrated
    Security=SSPI";

    Dave
  • sloan

    #2
    Re: Can't open database in browser control



    You always need to know and be aware of the account you're running under:

    Here is some crappy debugging code.

    I think the issue is you don't have sql server credentials for the user the
    program is running under.

    Go to Control Panel / Users and you can see a list of "built in" users that
    a windows machine has.



    private string FindIIdentity()

    {

    try

    {



    string returnValue = string.Empty;

    WindowsIdentity ident = WindowsIdentity .GetCurrent();

    returnValue = ident.Name;

    try

    {

    returnValue += " on " + System.Environm ent.MachineName ;

    }

    catch (Exception ex)

    {

    }

    return returnValue;

    }



    catch (Exception ex)

    {

    return "Error Finding Identity";

    }

    }




    "Parrot" <Parrot@discuss ions.microsoft. comwrote in message
    news:8C6AE469-4975-47A5-A266-56B3C8DF7568@mi crosoft.com...
    >I cannot access my SQL database in a browser control created in my C#
    >Windows
    application program I can, however, access the database from an IE
    browser.
    I get the ubiquitous "Login failed for NT AUTHORITY\NETWO RK SERVICE" error
    message. I researched all the advice on the internet and tried to add an
    NT
    AUTHORITY\NETWO RK SERVICE login to my database under the Security/Users
    tab
    using SQL Server Mangement. However, there is no NT AUTHORITY\NETWO RK
    SERVICE
    login in my SQL dialog, only an NT AUTHORITY\SYSTE M login. Why is that?
    Secondly, I finally was able to add an NT AUTHORITY\NETWO RK SERVICE
    manually
    to my database login and gave it all of the permissions but I still get
    the
    error when accessing the database through my Windows browser control.
    Below is my connection string.
    >
    Provider=SQLOLE DB; Data Source=Vista; Initial
    Catalog=Mydatab ase;Integrated
    Security=SSPI";
    >
    Dave

    Comment

    • =?Utf-8?B?UGFycm90?=

      #3
      Re: Can't open database in browser control

      Thanks for your reply. I inserted your debug code and determined that my
      user login was Vista\Dave under VISTA. I add Vista\Dave as a user for my
      database and giving it full permission and reran my application and I still
      get the NT AUTHORITY error. There has to be something to with the browser
      control as I don't get this error in my other Window dialogs in this
      application.
      Dave

      "sloan" wrote:
      >
      >
      You always need to know and be aware of the account you're running under:
      >
      Here is some crappy debugging code.
      >
      I think the issue is you don't have sql server credentials for the user the
      program is running under.
      >
      Go to Control Panel / Users and you can see a list of "built in" users that
      a windows machine has.
      >
      >
      >
      private string FindIIdentity()
      >
      {
      >
      try
      >
      {
      >
      >
      >
      string returnValue = string.Empty;
      >
      WindowsIdentity ident = WindowsIdentity .GetCurrent();
      >
      returnValue = ident.Name;
      >
      try
      >
      {
      >
      returnValue += " on " + System.Environm ent.MachineName ;
      >
      }
      >
      catch (Exception ex)
      >
      {
      >
      }
      >
      return returnValue;
      >
      }
      >
      >
      >
      catch (Exception ex)
      >
      {
      >
      return "Error Finding Identity";
      >
      }
      >
      }
      >
      >
      >
      >
      "Parrot" <Parrot@discuss ions.microsoft. comwrote in message
      news:8C6AE469-4975-47A5-A266-56B3C8DF7568@mi crosoft.com...
      I cannot access my SQL database in a browser control created in my C#
      Windows
      application program I can, however, access the database from an IE
      browser.
      I get the ubiquitous "Login failed for NT AUTHORITY\NETWO RK SERVICE" error
      message. I researched all the advice on the internet and tried to add an
      NT
      AUTHORITY\NETWO RK SERVICE login to my database under the Security/Users
      tab
      using SQL Server Mangement. However, there is no NT AUTHORITY\NETWO RK
      SERVICE
      login in my SQL dialog, only an NT AUTHORITY\SYSTE M login. Why is that?
      Secondly, I finally was able to add an NT AUTHORITY\NETWO RK SERVICE
      manually
      to my database login and gave it all of the permissions but I still get
      the
      error when accessing the database through my Windows browser control.
      Below is my connection string.

      Provider=SQLOLE DB; Data Source=Vista; Initial
      Catalog=Mydatab ase;Integrated
      Security=SSPI";

      Dave
      >
      >
      >

      Comment

      • sloan

        #4
        Re: Can't open database in browser control

        Yammers.

        I don't know then.


        My last check would be:

        Security / Logins
        Databases / MyDatabase / Security / Users


        Those are 2 different things in Sql Server.

        Now, when you create the login, and ALSO ADD THE "MyDatabase ", the "user"
        will be auto created.

        But I'd check both of those places.


        But I don't know. At least you know which user is trying to access the db
        under the integrated model.



        "Parrot" <Parrot@discuss ions.microsoft. comwrote in message
        news:16DDFCAC-E1D9-45B1-B2EA-FD86DFFA0761@mi crosoft.com...
        Thanks for your reply. I inserted your debug code and determined that my
        user login was Vista\Dave under VISTA. I add Vista\Dave as a user for my
        database and giving it full permission and reran my application and I
        still
        get the NT AUTHORITY error. There has to be something to with the browser
        control as I don't get this error in my other Window dialogs in this
        application.
        Dave
        >
        "sloan" wrote:
        >
        >>
        >>
        >You always need to know and be aware of the account you're running under:
        >>
        >Here is some crappy debugging code.
        >>
        >I think the issue is you don't have sql server credentials for the user
        >the
        >program is running under.
        >>
        >Go to Control Panel / Users and you can see a list of "built in" users
        >that
        >a windows machine has.
        >>
        >>
        >>
        >private string FindIIdentity()
        >>
        >{
        >>
        >try
        >>
        >{
        >>
        >>
        >>
        >string returnValue = string.Empty;
        >>
        >WindowsIdentit y ident = WindowsIdentity .GetCurrent();
        >>
        >returnValue = ident.Name;
        >>
        >try
        >>
        >{
        >>
        >returnValue += " on " + System.Environm ent.MachineName ;
        >>
        >}
        >>
        >catch (Exception ex)
        >>
        >{
        >>
        >}
        >>
        >return returnValue;
        >>
        >}
        >>
        >>
        >>
        >catch (Exception ex)
        >>
        >{
        >>
        >return "Error Finding Identity";
        >>
        >}
        >>
        >}
        >>
        >>
        >>
        >>
        >"Parrot" <Parrot@discuss ions.microsoft. comwrote in message
        >news:8C6AE46 9-4975-47A5-A266-56B3C8DF7568@mi crosoft.com...
        >I cannot access my SQL database in a browser control created in my C#
        >Windows
        application program I can, however, access the database from an IE
        browser.
        I get the ubiquitous "Login failed for NT AUTHORITY\NETWO RK SERVICE"
        error
        message. I researched all the advice on the internet and tried to add
        an
        NT
        AUTHORITY\NETWO RK SERVICE login to my database under the Security/Users
        tab
        using SQL Server Mangement. However, there is no NT AUTHORITY\NETWO RK
        SERVICE
        login in my SQL dialog, only an NT AUTHORITY\SYSTE M login. Why is that?
        Secondly, I finally was able to add an NT AUTHORITY\NETWO RK SERVICE
        manually
        to my database login and gave it all of the permissions but I still get
        the
        error when accessing the database through my Windows browser control.
        Below is my connection string.
        >
        Provider=SQLOLE DB; Data Source=Vista; Initial
        Catalog=Mydatab ase;Integrated
        Security=SSPI";
        >
        Dave
        >>
        >>
        >>

        Comment

        • =?Utf-8?B?UGFycm90?=

          #5
          Re: Can't open database in browser control

          It really doesn't make any sense. I am getting an error on a login for NT
          AUTHORITY yet my Window Identity is Vista\Dave. I think the only way I can
          get around it is to provide a user id and password in my connection instead
          of using the Integrated Security=SSPI. Looks like a bug to me but I can't
          believe I am the only person with this problem.
          Dave

          "sloan" wrote:
          Yammers.
          >
          I don't know then.
          >
          >
          My last check would be:
          >
          Security / Logins
          Databases / MyDatabase / Security / Users
          >
          >
          Those are 2 different things in Sql Server.
          >
          Now, when you create the login, and ALSO ADD THE "MyDatabase ", the "user"
          will be auto created.
          >
          But I'd check both of those places.
          >
          >
          But I don't know. At least you know which user is trying to access the db
          under the integrated model.
          >
          >
          >
          "Parrot" <Parrot@discuss ions.microsoft. comwrote in message
          news:16DDFCAC-E1D9-45B1-B2EA-FD86DFFA0761@mi crosoft.com...
          Thanks for your reply. I inserted your debug code and determined that my
          user login was Vista\Dave under VISTA. I add Vista\Dave as a user for my
          database and giving it full permission and reran my application and I
          still
          get the NT AUTHORITY error. There has to be something to with the browser
          control as I don't get this error in my other Window dialogs in this
          application.
          Dave

          "sloan" wrote:
          >
          >
          You always need to know and be aware of the account you're running under:
          >
          Here is some crappy debugging code.
          >
          I think the issue is you don't have sql server credentials for the user
          the
          program is running under.
          >
          Go to Control Panel / Users and you can see a list of "built in" users
          that
          a windows machine has.
          >
          >
          >
          private string FindIIdentity()
          >
          {
          >
          try
          >
          {
          >
          >
          >
          string returnValue = string.Empty;
          >
          WindowsIdentity ident = WindowsIdentity .GetCurrent();
          >
          returnValue = ident.Name;
          >
          try
          >
          {
          >
          returnValue += " on " + System.Environm ent.MachineName ;
          >
          }
          >
          catch (Exception ex)
          >
          {
          >
          }
          >
          return returnValue;
          >
          }
          >
          >
          >
          catch (Exception ex)
          >
          {
          >
          return "Error Finding Identity";
          >
          }
          >
          }
          >
          >
          >
          >
          "Parrot" <Parrot@discuss ions.microsoft. comwrote in message
          news:8C6AE469-4975-47A5-A266-56B3C8DF7568@mi crosoft.com...
          I cannot access my SQL database in a browser control created in my C#
          Windows
          application program I can, however, access the database from an IE
          browser.
          I get the ubiquitous "Login failed for NT AUTHORITY\NETWO RK SERVICE"
          error
          message. I researched all the advice on the internet and tried to add
          an
          NT
          AUTHORITY\NETWO RK SERVICE login to my database under the Security/Users
          tab
          using SQL Server Mangement. However, there is no NT AUTHORITY\NETWO RK
          SERVICE
          login in my SQL dialog, only an NT AUTHORITY\SYSTE M login. Why is that?
          Secondly, I finally was able to add an NT AUTHORITY\NETWO RK SERVICE
          manually
          to my database login and gave it all of the permissions but I still get
          the
          error when accessing the database through my Windows browser control.
          Below is my connection string.

          Provider=SQLOLE DB; Data Source=Vista; Initial
          Catalog=Mydatab ase;Integrated
          Security=SSPI";

          Dave
          >
          >
          >
          >
          >
          >

          Comment

          • Hans Kesting

            #6
            Re: Can't open database in browser control

            on 29-7-2008, Parrot supposed :
            Thanks for your reply. I inserted your debug code and determined that my
            user login was Vista\Dave under VISTA. I add Vista\Dave as a user for my
            database and giving it full permission and reran my application and I still
            get the NT AUTHORITY error. There has to be something to with the browser
            control as I don't get this error in my other Window dialogs in this
            application.
            Dave
            >
            Is this "Vista" (from "Vista\Dave ") a domain or your local machine?

            If it is a domain, does your database server have access to the same
            domain?

            If it is your local machine, then that database server will not know
            about that account. Best to use SqlServer login then (which you need to
            enable explicitly in SqlServer as it is disabled by default). You will
            need to specify username and password in your connectionstrin g.

            Hans Kesting


            Comment

            • =?Utf-8?B?UGFycm90?=

              #7
              Re: Can't open database in browser control

              The problem is on my local machine and I agree that the only way out of this
              problem is to use a user id and password in my connection string. It's not
              want I want to do as that requires more programming maintenance but I don't
              see any other way around this problem. In summary, I feel this problem is a
              bug in disguise and has wasted an awful lot of my time and others trying to
              find a solution to something that should be simple.
              Dave

              "Hans Kesting" wrote:
              on 29-7-2008, Parrot supposed :
              Thanks for your reply. I inserted your debug code and determined that my
              user login was Vista\Dave under VISTA. I add Vista\Dave as a user for my
              database and giving it full permission and reran my application and I still
              get the NT AUTHORITY error. There has to be something to with the browser
              control as I don't get this error in my other Window dialogs in this
              application.
              Dave
              >
              Is this "Vista" (from "Vista\Dave ") a domain or your local machine?
              >
              If it is a domain, does your database server have access to the same
              domain?
              >
              If it is your local machine, then that database server will not know
              about that account. Best to use SqlServer login then (which you need to
              enable explicitly in SqlServer as it is disabled by default). You will
              need to specify username and password in your connectionstrin g.
              >
              Hans Kesting
              >
              >
              >

              Comment

              Working...