I have coded a ASP form for inventory purposes and want to get the current installed printers for a workstation. What I have found out is that I need to do this via a cookie (due to ASP constraints) and can get close but since Im such a n00b Im stuck on something. First here is my code:
This all works fine IF I change the cookPrint("PrinterName") to a static name (Ie = "Printer"). But if I try to use the above line and get the installed printers I get the following error:
Value of type system.drawing.printing.printersettings.stringcollection cannot be converted to String
Im obviously leaving something out and I hope someone can point out what I need to do. Thanks.
Code:
If Request.Browser.Cookies Then
Response.Cookies("Printers").Expires = DateTime.Now
Dim cookPrint As New HttpCookie("Printers", Now.ToString)
cookPrint("PrinterName") = printersettings.installedprinters
cookPrint.Expires = DateTime.Now.AddDays(1)
Response.Cookies.Add(cookPrint)
End If
Dim cookPrintInfo As HttpCookie = Request.Cookies("Printers")
print = cookPrintInfo("PrinterName")
Value of type system.drawing.printing.printersettings.stringcollection cannot be converted to String
Im obviously leaving something out and I hope someone can point out what I need to do. Thanks.