Home > ASP Development > Calling a sub

Calling a sub



Brain-dead moment.



Got the below code:




Code:


<script type="text/vbscript">
<!--

sub dean()
Set Shell = CreateObject("WScript.Network")
Shell.MapNetworkDrive "r:", "\\machineName\c$"
end sub
' -->
</script>






How can I call that from an ASP page?



Cheers,



Dean

    
Guest


Hmm, if its on the same page or in a include file:



Call dean()



or



dean()



I haven't used the Sub format to often, I usually stick to the Function format.

Was this answer helpful ? Yes No   
Guest


I thought as much but for some reason it doens't like it.



Just get:



Type mismatch: 'dean'



Cheers,



Dean

Was this answer helpful ? Yes No   
Guest


Well, a quick google search says you jsut do: dean



if that doesn't work try switching it to a function.

Was this answer helpful ? Yes No   
Guest


are you trying to call that VB script function

from between <%%> tags?

you cant do that

Was this answer helpful ? Yes No   
Guest


Bugger.



Was hoping I wouldn't get that answer.



If I put this code:




Code:


Set Shell = CreateObject("WScript.Network")
Shell.MapNetworkDrive "r:", "\\lcfax\c$"






between <% %> tags I get Access Denied.



Ah well; back to the drawing board.



Cheers,



Dean

Was this answer helpful ? Yes No   
Guest


no problem, sorry to be the one to pass the bad news

Was this answer helpful ? Yes No   
Guest


Ah ha!



Got it. Wasn's supply a username/password via the serverside code; when doing it as clientside it already had the correct credentials.



Obvious now I think about it!



Cheers,



Dean

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved