[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Error Type: Microsoft VBScript runtime (0x800A01A8) - Object required: ''

Posted on 2005-04-19
22
Medium Priority
?
14,811 Views
Last Modified: 2012-05-05
Hello,

I don't have any experience with ASP but I need a little script (connect.asp) that maps network drives with an account and password that users enter in a HTML form. I found some code samples on different sites and created the script below. When running that script I get the following error message after pressing the SUBMIT button:

The page cannot be displayed
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/logon/connect.asp, line 13

This is line 13:
Set WshNetwork = WScript.CreateObject("WScript.Network")

Please help me - I don't know what I'm doing... Thanks in advance!
Regards, ghana


************************************************************
This is the whole script:


<%@ Language=VBScript %>
<HTML><HEAD><TITLE>Logon</TITLE></HEAD>
<BODY>
<%
dim sDomain, sUser, sPwd
sDomain = "DOMAIN"
sUser = Request.Form("user")
sPwd = Request.Form("password")

if sUser <> "" then
   Dim WshNetwork
   Set WshNetwork = WScript.CreateObject("WScript.Network")
   WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", 0, sDomain & "\" & sUser, sPwd  
   Response.Write "DONE<BR>"
end if
%>
<FORM action="connect.asp" method="post">
<TABLE BORDER="1">
<TR><TH>
User</TH><TD>
<INPUT type="text" name="user">
</TD></TR>
<TR><TH>
Password</TH><TD>
<INPUT type="password" name="password">
</TD></TR>
</TABLE>
<INPUT type="submit" value="Submit" id="submit1" name="submit1">
<INPUT type="reset" value="Reset" id="reset1" name="reset1">
</FORM>
</BODY>
</HTML>
0
Comment
Question by:ghana
  • 9
  • 8
  • 3
  • +1
22 Comments
 
LVL 9

Expert Comment

by:cb1393
ID: 13815672
Try: Set WshNetwork = Server.CreateObject("WScript.Network")
0
 
LVL 9

Expert Comment

by:cb1393
ID: 13815693
Disregard my last post... sorry about that.
0
 
LVL 9

Expert Comment

by:cb1393
ID: 13815714
I know this is related to installing printers, but it may be of some assistance:

http://www.experts-exchange.com/Web/Web_Languages/ASP/Q_20183239.html
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13815716
If I am not mistaken, I think that this is line 13?

  WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", 0, sDomain & "\" & sUser, sPwd  



To be sure, what happens if you do this:

<%@ Language=VBScript %>
<HTML><HEAD><TITLE>Logon</TITLE></HEAD>
<BODY>
<%
dim sDomain, sUser, sPwd
sDomain = "DOMAIN"
sUser = Request.Form("user")
sPwd = Request.Form("password")

if sUser <> "" then
   Dim WshNetwork
   Set WshNetwork = WScript.CreateObject("WScript.Network")
   Response.write("WshNetwork object created")
   Response.end
   WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", 0, sDomain & "\" & sUser, sPwd  
   Response.Write "DONE<BR>"
end if
%>
<FORM action="connect.asp" method="post">
<TABLE BORDER="1">
<TR><TH>
User</TH><TD>
<INPUT type="text" name="user">
</TD></TR>
<TR><TH>
Password</TH><TD>
<INPUT type="password" name="password">
</TD></TR>
</TABLE>
<INPUT type="submit" value="Submit" id="submit1" name="submit1">
<INPUT type="reset" value="Reset" id="reset1" name="reset1">
</FORM>
</BODY>
</HTML>
0
 
LVL 11

Author Comment

by:ghana
ID: 13815777
>  If I am not mistaken, I think that this is line 13?
> WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", 0, sDomain & "\" & sUser, sPwd  

No, there is 1 single empy line as first line. The line causing the error is really this one:
Set WshNetwork = WScript.CreateObject("WScript.Network")
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13815793
From microsoft, this is the correct syntax which you follow:

object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])

However, you may need to use False rather than 0 like this:

WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", False, sDomain & "\" & sUser, sPwd  

Finally, is possible to try this without the authentication bit like this:


WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$"

FtB
0
 
LVL 11

Author Comment

by:ghana
ID: 13815827
I have executed the script with your modification and got this message (I did delete the first empty line - because of that it's now line 12...):

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
--------------------------------------------------------------------------------
Technical Information (for support personnel)

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: ''
/logon/test.asp, line 12
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13815932
Okay, I don't have much experience with WScript, but let's try. I can run this without an error but can't test in my environment:

<%@ Language=VBScript %>
<HTML><HEAD><TITLE>Logon</TITLE></HEAD>
<BODY>
<%
dim sDomain, sUser, sPwd
sDomain = "DOMAIN"
sUser = Request.Form("user")
sPwd = Request.Form("password")

if sUser <> "" then
   Dim WshNetwork
    Set WshNetwork = Server.CreateObject("WScript.Network")
   WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", 0, sDomain & "\" & sUser, sPwd  
   Response.Write "DONE<BR>"
end if
%>
<FORM action="" method="post">
<TABLE BORDER="1">
<TR><TH>
User</TH><TD>
<INPUT type="text" name="user">
</TD></TR>
<TR><TH>
Password</TH><TD>
<INPUT type="password" name="password">
</TD></TR>
</TABLE>
<INPUT type="submit" value="Submit" id="submit1" name="submit1">
<INPUT type="reset" value="Reset" id="reset1" name="reset1">
</FORM>
</BODY>
</HTML>
0
 
LVL 11

Author Comment

by:ghana
ID: 13815955
When executing this lines as an VBS file it will work without errors and map the network drive:

Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "F:", "\\srvinstall01\c$", 0, sDomain & "\" & sUser, sPwd  

I've also tried to replace '0' with 'False' - but unfortunately it's the same result.
0
 
LVL 11

Author Comment

by:ghana
ID: 13815983
I get the following error with your last code:

HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services
Error Type:
Server object, ASP 0177 (0x8007007F)
8007007f
/logon/test.asp, line 12
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13815990
To make sure that I understand--

Are you trying to map a drive to the server or to the client? If that latter, then you may need to do something quite different. Perhaps wscript shell on the client?

FtB
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13815998
In particular, I was thinking that you might use WScript shell to run the .vbs file on the client.

ftB
0
 
LVL 11

Author Comment

by:ghana
ID: 13816024
I want to map a drive to the client. The user should enter the account name and password and these data should be used for mapping the drive(s).
0
 
LVL 11

Author Comment

by:ghana
ID: 13816122
>  In particular, I was thinking that you might use WScript shell to run the .vbs file on the client.
That sounds good. Is it possible to pass the username and password that was entered in the web page to the .vbs file? If yes, how to do that?
0
 
LVL 46

Accepted Solution

by:
fritz_the_blank earned 2000 total points
ID: 13816227
I am looking around now. Part of the problem is that the security model discourages web pages from modifying client settings--I am sure that you can see why this would be a problem!!! The WScript network bit is for mapping drives on the same machine that is running the code, in your case, the server! So, what we need is to find some way to make this run on the client, and I am thinking that it is going to have to be some sort of ActiveX control, but that has its own security issues.

FtB
0
 
LVL 11

Author Comment

by:ghana
ID: 13817504
Thanks, FtB! Maybe the ASP page isn't the best solution to do what I need? But I thought it would be very comfortable if we had to put only one single file on a web server and the users can then use it to get connected to different servers. First I tried to create a login script using  Windows batch commands. But I didn't find a solution for entering the password without being visible in plain text on the screen. That was the reason why I started with HTML forms. But if the password input can be masqueraded any other script solution is welcome.
0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 13818149
Hai,

To have a password field on html page

<input type="password" name="txtpwd" id="txtpwd" value="">

Bye
Ajai
0
 
LVL 11

Expert Comment

by:ajaikumarr
ID: 13818155
Sorry ignore my old post.

Bye
Ajai
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13818470
I haven't found anything yet, and I am less than hopeful...usually people do the mapping when the user logs into windows.


FtB
0
 
LVL 11

Author Comment

by:ghana
ID: 13821287
>  I haven't found anything yet, and I am less than hopeful...usually people do the mapping when the user logs into windows.
That's right, but we have to connect to servers in another domain with different usernames. And we are not allowed to create a trust between these domains. FtB, thanks for your help anyhow!
0
 
LVL 11

Author Comment

by:ghana
ID: 13823413
FtB, again thanks for your help! Sometimes the correct answer is 'you can't do that' - and this question is one of those. For these who are interested in the solution of the underlying problem please see http://www.experts-exchange.com/Operating_Systems/Win2000/Q_21393816.html.
0
 
LVL 46

Expert Comment

by:fritz_the_blank
ID: 13825192
Thank you and glad to have helped,

FtB
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question