Creating random directories in VB.NET

    Date: 06/02/06 (Asp Dot Net)    Keywords: html, asp, security, web

    Hi folks...long time reader, first time poster.

    I have a piece of code that SHOULD be working. It is simple and straight forward, creating a directory.

    The code:

    Dim tmpfldr As String = secret.buildFLDR() ' Build a 10 character, semi random string for a DIR Name
    'This is the URL that will be used to create the links
    targetfullpath = "http://" & cfg.serverURL & "/" & cfg.RootDBFolder & "/" & tmpfldr
    filesysfullpath = cfg.filesysFLDR & "\" & cfg.RootDBFolder & "\" & tmpfldr
    Me.lblUploadStat.Text = Me.filesysfullpath
    'filesysfullpath = "\" & tmpfldr
    Dim tdir As DirectoryInfo
    Dim usr As String = "Current executing thread is " + System.Security.Principal.WindowsIdentity.GetCurrent().Name
    Try
    If Directory.Exists(filesysfullpath) = False Then
    ' Create the directory.
    Directory.CreateDirectory(filesysfullpath)

    ....

    It gets to this line and throws an error:

    System.IO.DirectoryNotFoundException: Could not find a part of the path "e:\". at System.IO.__Error.WinIOError(Int32 errorCode, String str) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path) at System.IO.Directory.CreateDirectory(String path) at mjbears.drpbox.loadcfg() in C:\Documents and Settings\Jim\VSWebCache\sandbox.pixieproductions.com\default.aspx.vb:line 100

    The "filesysfullpath" resolves out to "e:\web\public_html\username\sandbox\dropbox\BUILDFLDR" where BUILDFLDR is the random string. I have read/write privileges in "dropbox" folder, so I should be able to write/create a directory there.

    Help! I've been hacking on this code for hours!

    Peace,

    Bear

    Source: http://community.livejournal.com/aspdotnet/69908.html

« Classes and Include Files || Problem with a query »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home