hurrikane
12-06-2002, 12:24 PM
Is there a way to have a network printer added to the users computer using ASP or any other web based code?
![]() | View Full Version : Add Printer using ASP hurrikane 12-06-2002, 12:24 PM Is there a way to have a network printer added to the users computer using ASP or any other web based code? Rich2k 12-06-2002, 12:28 PM Not without an active x control as web pages are not allowed access to the users system (well they aren't supposed to be, but there are plenty of security holes out there!) hurrikane 12-06-2002, 12:51 PM I know there is this command in VBscript AddWindowsPrinterConnection can you use that with ASP? protecweb 12-06-2002, 12:55 PM With the correct privilages you should be able to do that with the windows Script Host (WSH). Try this: http://support.microsoft.com/default.aspx?scid=KB;en-us;q263226 hurrikane 12-06-2002, 12:57 PM Yes but how do you call that script from ASP in a web site? Rich2k 12-06-2002, 03:29 PM You CANNOT interact directly with a users PC from a web page without either an active X control or a HTC/HTA document (all of which the user has to agree to run/install). To allow a web server to interact with properties and settings on your PC is a huge security risk! protecweb 12-06-2002, 04:58 PM I figured you were talking about an intranet? Anywho, if you wanted to call the script within that kind of environment you could do from an ASP page like this: <% dim w set w = Server.CreateObject("WScript.Shell") w.run "C:\pathtomyscript\myscript.vbs" set w = Nothing %> Once again you will need script execution priviliges. hurrikane 12-06-2002, 05:09 PM Now we are getting somewhere... Actually IIS has a built in features but im trying to make a custom one. Now my question for you is if I am run that external vbs script is there a way to pass variables from the web site to the vbs file? protecweb 12-06-2002, 05:14 PM Good question. Um i cant remember how thats done in the ASP. But if you did it from a command line you would add the params one after the other seperated by a space. To retrieve them in the wsh file you would do this as they are placed into an array. Set ArgObj = WScript.Arguments var1 = ArgObj(0) var2 = ArgObj(1) 'etc etc set ArgObj = Nothing Obviously its easier to use a loop to grab them. Rich2k 12-07-2002, 06:41 AM But remember they are going to have to change settings on their computer to allow it to run. Across a web server connection you cannot run local files on their computer without reconfiguring IE. Sorry but if your web site could change my printer settings without my permission... I'd complain to Microsoft and they would probably close the security hole! |