查找客户端打印机ASP.NET



从我所读的内容中,出于安全原因,使用现代浏览器的本地打印机无法找到它。我有一些条件可能会使答案与众不同。

  1. 我正在尝试从公司网络中吸引客户本地打印机。因此,这不是在"外部"发表
  2. 我以为几年前Microsoft发布了一个小版本的.NET,可以从客户端浏览器中运行。如果是这样,我仍然想知道是否可以检查客户本地打印机。

谢谢

提供检索客户打印机的外观的一种方法是在同一网络中运行具有相同访问权限的网络中的服务器端应用程序。Silverlight可能可以做到。不幸的是,我没有经验。

在此处查看:获取网络打印机列表Silverlight

这最终是很多工作,很少有信息,因为我在互联网上几乎所有搜索解决方案都假定我们想从浏览器中获取客户端的打印机。我们想通过网络找到此类信息。

解决方案最终与DirectorySearch等类似。这是删除了一些隐私内容的代码。它处于pof状态,因此它可能没有那么出色的语法

Dim list As New List(Of String)
Dim listtemp As New List(Of String)
Dim resultCollection As SearchResultCollection
Dim computer_name As String = System.Net.Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName.Replace(".ourcompany.com", "").ToLower  'clients machine name       
    Dim dirEntry As New DirectoryEntry("LDAP://DC=OURCOMPANY, DC=com")
    Dim dirSearcher As New DirectorySearcher(dirEntry)
    dirSearcher.Filter = "objectCategory=printQueue"
    dirSearcher.PropertyNamesOnly = True
    dirSearcher.PropertiesToLoad.Add("Name")
    dirSearcher.SearchScope = SearchScope.Subtree
    resultCollection = dirSearcher.FindAll()
    For Each sresult As SearchResult In resultCollection
        If sresult.GetDirectoryEntry.Name.ToLower.Contains(computer_name) Then
            list.Add(sresult.GetDirectoryEntry.Name.ToLower.Substring(3).Replace(computer_name + "-", ""))
        End If
    Next

最新更新