• T4CH
  • NEWS
  • VIDEO
Forum > Software

Problema con pagina ASP

Discussione inserita in 'Software' da DrugsMatt, 30 Ottobre 2009.

  1. DrugsMatt techUser

    Ciao a tutti.



    Stavo provando a ottenere tramite codice ASP le informazioni riguardanti tutte le unità di sistema.



    Il codice è il seguente:

    Code:
    <%
    
    Option explicit
    
    Sub Main()
    
     Dim objFSO 'As Scripting.FileSystemObject
    
     Dim drvLoop ' As Scripting.Drive
    
     
    
     Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    
     For Each drvLoop In objFSO.Drives
    
         Response.Write drvLoop.DriveLetter & ":\"
    
         If dvrLoop.DriveType = Fixed _
    
         Or dvrLoop.IsReady Then
    
           Response.Write "   Dimensione totale:   " _
    
           & Format$(drvLoop.TotalSize / (1024 ^ 2), "0.00 MB")
    
           Response.Write "   Spazio libero:   " _
    
           & Format$(drvLoop.FreeSpace / (1024 ^ 2), "0.00 MB")
    
           Response.Write "   Etichetta di volume:   " & dvrLoop.VolumeName
    
         Else
    
           Response.Write "   Informazioni non disponibili"
    
         End If
    
     Next 
    
    
    
     Set objFSO = Nothing
    
    
    
    End Sub
    
    %>
    
    


    Premetto, l'ho preso da un manuale, non funziona, mi riporta una pagina bianca vuota come risultato.

    Non capisco che formattazione sia la (Format$) ho provato a formattare diversamente ma senza risultato, riporta o la stessa pagina bianca o l'errore 500 classico.



    Aiuti? Suggerimenti?
    DrugsMatt, 30 Ottobre 2009
    #1
  2. UnknownError techNewbie

    mmh ...scusa ma se la pagina asp la devi ospitare su un server per farla girare (in locale non funzia a meno che non hai IIS)...se funzionasse ti darebbe le informazioni sull' HD del server il che mi sembra un pochetto improbabile :confused:
    UnknownError, 11 Febbraio 2010
    #2
  3. DrugsMatt techUser

    Una risposta dopo mesi! Sono lusingato.. Dunque, premettendo che non sono più andato avanti con gli esperimenti, funzionasse sarebbe interessante, l'IIS è a posto, funziona, secondo te non è possibile rilevare le info dell'HD del server tramite questo codice? Inoltre non ho capito sto Format$...
    DrugsMatt, 12 Febbraio 2010
    #3
  4. UnknownError techNewbie

    prova così...



    <%

    Set FileSystemObject = Server.CreateObject("Scripting.FileSystemObject")

    Set Drives = FileSystemObject.Drives



    For Each DiskDrive in Drives



    DriveLetter = DiskDrive.DriveLetter

    DriveType = DiskDrive.DriveType



    Select Case DriveType

    Case "0" DriveType = "
    Unknown type of drive"

    Case "1" DriveType = "
    Removable drive"

    Case "2" DriveType = "
    Fixed drive"

    Case "3" DriveType = "
    Network drive"

    Case "4" DriveType = "
    CD-ROM drive"

    Case "5" DriveType = "
    RAM Disk"

    End Select



    Response.Write "
    Drive " & DriveLetter & " is a " & DriveType & "
    "



    Next



    Set Drives = nothing

    Set FileSystemObject = nothing

    %>






    io ho provato così perchè non ho iis e funziona



    <script language="vbscript" action="OnLoad">

    Sub info()

    Set FileSystemObject = CreateObject("Scripting.FileSystemObject")

    Set Drives = FileSystemObject.Drives



    For Each DiskDrive in Drives



    DriveLetter = DiskDrive.DriveLetter

    DriveType = DiskDrive.DriveType



    Select Case DriveType

    Case "0" DriveType = "Unknown type of drive"

    Case "1" DriveType = "Removable drive"

    Case "2" DriveType = "Fixed drive"

    Case "3" DriveType = "Network drive"

    Case "4" DriveType = "CD-ROM drive"

    Case "5" DriveType = "RAM Disk"

    End Select



    MsgBox "Drive " & DriveLetter & " is a " & DriveType & "
    "



    Next



    Set Drives = nothing

    Set FileSystemObject = nothing

    End Sub

    </script>

    <body onload="vbscript:info()">

    </body>
    UnknownError, 12 Febbraio 2010
    #4
  5. UnknownError techNewbie

    ah mi è sfuggito il fatto che ti servono le dimensioni XD ...puoi usare tranquillamente DiskDrive.TotalSize e DiskDrive.FreeSpace solo che ti da i risultati in bytes ...cioè un numero abnorme XD
    UnknownError, 16 Febbraio 2010
    #5
Password dimenticata?
SU TERMINI DI SERVIZIO CONTATTACI