Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. [Message Deleted]

[Message Deleted]

Scheduled Pinned Locked Moved C#
18 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A anithagaraga

    Sorry to Use the word Urgent.... I want the list of the names of the computers attached to local network? ThankQ....

    L Offline
    L Offline
    Lost User
    wrote on last edited by
    #8

    anithagaraga wrote:

    Sorry to Use the word Urgent

    Ah, lots of people with questions tend to add the phrase "urgent". We're not being paid, so we don't like to be rushed.. I downloaded the source-code that was attached to the article, and have modified it to work in a web-environment. The modifications are simple; added two using-directives and removed exception-handling. Also, I added the NetworkBrowser-class to the code-file of the ASP.NET page. The rest of the code hasn't been modified. The code below is a simple webpage, which uses the code from the aforementioned article; using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Runtime.InteropServices; using System.Security; public partial class t_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { NetworkBrowser nb = new NetworkBrowser(); foreach (string pc in nb.getNetworkComputers()) { ListBox1.Items.Add(pc); } } } #region NetworkBrowser CLASS /// /// Provides a mechanism for supplying a list of all PC names in the local network. /// This collection of PC names is used in the /// form ///

    /// This class makes use of a DllImport instruction. The purpose of which is as follows: /// When a DllImport declaration is made in managed code (C#) it is a call to a legacy /// unmanaged code module, normally a C++ Dynamic Link Library. These C++ Dll's are /// usually part of the operating system API, or some other vendors API, and must be /// used to carry out operations that are not native within the managed code C# framework. /// This is fairly normal within the windows world. The only thing that needs careful consideration /// is the construction of the correct type of STRUCTS, object pointers, and attribute markers, /// which all contribute to making the link between managed (C#) and unmanaged code (C++) /// more seamless ///

    /// This class makes use of the following Dll calls /// /// /// Netapi32.dll : NetServerEnum, The NetServerEnum function lists all servers /// of the specified type that are visible in a

    A 1 Reply Last reply
    0
    • L Lost User

      anithagaraga wrote:

      Sorry to Use the word Urgent

      Ah, lots of people with questions tend to add the phrase "urgent". We're not being paid, so we don't like to be rushed.. I downloaded the source-code that was attached to the article, and have modified it to work in a web-environment. The modifications are simple; added two using-directives and removed exception-handling. Also, I added the NetworkBrowser-class to the code-file of the ASP.NET page. The rest of the code hasn't been modified. The code below is a simple webpage, which uses the code from the aforementioned article; using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.Runtime.InteropServices; using System.Security; public partial class t_Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { NetworkBrowser nb = new NetworkBrowser(); foreach (string pc in nb.getNetworkComputers()) { ListBox1.Items.Add(pc); } } } #region NetworkBrowser CLASS /// /// Provides a mechanism for supplying a list of all PC names in the local network. /// This collection of PC names is used in the /// form ///

      /// This class makes use of a DllImport instruction. The purpose of which is as follows: /// When a DllImport declaration is made in managed code (C#) it is a call to a legacy /// unmanaged code module, normally a C++ Dynamic Link Library. These C++ Dll's are /// usually part of the operating system API, or some other vendors API, and must be /// used to carry out operations that are not native within the managed code C# framework. /// This is fairly normal within the windows world. The only thing that needs careful consideration /// is the construction of the correct type of STRUCTS, object pointers, and attribute markers, /// which all contribute to making the link between managed (C#) and unmanaged code (C++) /// more seamless ///

      /// This class makes use of the following Dll calls /// /// /// Netapi32.dll : NetServerEnum, The NetServerEnum function lists all servers /// of the specified type that are visible in a

      A Offline
      A Offline
      anithagaraga
      wrote on last edited by
      #9

      Its running with out any Errors but i am not getting any result from this code. I have tried like this protected void Page_Load(object sender, EventArgs e) { Response.Write(Request.ServerVariables["LOGON_USER"]); } then it is showing my computer name only.But i want all the users Computer Names. Thank You.....

      A 1 Reply Last reply
      0
      • A anithagaraga

        Its running with out any Errors but i am not getting any result from this code. I have tried like this protected void Page_Load(object sender, EventArgs e) { Response.Write(Request.ServerVariables["LOGON_USER"]); } then it is showing my computer name only.But i want all the users Computer Names. Thank You.....

        A Offline
        A Offline
        anithagaraga
        wrote on last edited by
        #10

        The code which you have sent is same as the link which you have sent.I am working for the web application but you have given the code for desktop application....

        L 1 Reply Last reply
        0
        • A anithagaraga

          The code which you have sent is same as the link which you have sent.I am working for the web application but you have given the code for desktop application....

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #11

          anithagaraga wrote:

          The code which you have sent is same as the link which you have sent

          True!

          anithagaraga wrote:

          .I am working for the web application but you have given the code for desktop application....

          It is not. The example is a desktop-application, but the code to retrieve the computer-names can be used in both. I have posted an example of how to use this code from a webpage a few posts' ago. Look for yourself, here it is; http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2775380 That code runs in a browser and shows a Listbox that contains all the names of the computers that are present in the local network. Good luck :)

          A 1 Reply Last reply
          0
          • L Lost User

            anithagaraga wrote:

            The code which you have sent is same as the link which you have sent

            True!

            anithagaraga wrote:

            .I am working for the web application but you have given the code for desktop application....

            It is not. The example is a desktop-application, but the code to retrieve the computer-names can be used in both. I have posted an example of how to use this code from a webpage a few posts' ago. Look for yourself, here it is; http://www.codeproject.com/script/Forums/View.aspx?fid=1649&msg=2775380 That code runs in a browser and shows a Listbox that contains all the names of the computers that are present in the local network. Good luck :)

            A Offline
            A Offline
            anithagaraga
            wrote on last edited by
            #12

            But its not working boss.... :(( i am not getting any result in the Listbox....

            L 1 Reply Last reply
            0
            • A anithagaraga

              But its not working boss.... :(( i am not getting any result in the Listbox....

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #13

              Can you see a list of computers when you open the Windows Explorer? Please check the node "My Network Places\Entire Network\Microsoft Windows Network". Are there more computers in the list, or can you only see your own computer there?

              A 1 Reply Last reply
              0
              • L Lost User

                Can you see a list of computers when you open the Windows Explorer? Please check the node "My Network Places\Entire Network\Microsoft Windows Network". Are there more computers in the list, or can you only see your own computer there?

                A Offline
                A Offline
                anithagaraga
                wrote on last edited by
                #14

                no i can't see my computer name also.....I am getting empty listbox when i run the application...

                L 1 Reply Last reply
                0
                • A anithagaraga

                  no i can't see my computer name also.....I am getting empty listbox when i run the application...

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #15

                  I'm sorry, seems I cannot help here.. :sigh:

                  D A 2 Replies Last reply
                  0
                  • L Lost User

                    I'm sorry, seems I cannot help here.. :sigh:

                    D Offline
                    D Offline
                    Dave Kreskowiak
                    wrote on last edited by
                    #16

                    That's the problem with just handing over code. There's no attempt on the part of the receiver to try and understand it and modify it to their own needs.

                    A guide to posting questions on CodeProject[^]
                    Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                         2006, 2007, 2008

                    1 Reply Last reply
                    0
                    • L Lost User

                      I'm sorry, seems I cannot help here.. :sigh:

                      A Offline
                      A Offline
                      anithagaraga
                      wrote on last edited by
                      #17

                      Hi, First of all Thanks alot for helping me yesterday.I have done some changes in that code & right now its working.....Thanks Boss...

                      L 1 Reply Last reply
                      0
                      • A anithagaraga

                        Hi, First of all Thanks alot for helping me yesterday.I have done some changes in that code & right now its working.....Thanks Boss...

                        L Offline
                        L Offline
                        Lost User
                        wrote on last edited by
                        #18

                        You're welcome and well done :cool:

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups