Problem Uploading files using ASPUpload using Azure Storage File Service (Network Drive)

We are having an issue when using ASPUpload (http://www.aspupload.com/) and a Network Drive plugged into a VM Azure Server

If we point our application (Classic ASP) to point to a computer drive (C:) for example, it will find it and upload documents without any issues.
If we point the path to be a Storage File Drive (Z://) says it can't find it. We read some and found that the path had to the something like this:

\\ourstorage.file.core.windows.net\ourfileshare

But the site says it cannot find the path with either Z or the path above.
After reading some documentation we found that we needed to add the line below, which we did then we get a 'username and password incorrect' Even though they are the correct ones. I tested by typing the path in windows explorer then entering the credentials.

upload.LogonUser "", "username", "password"

Anyone with experience doing this will be greatly appreciated.
LVL 1
AleksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I have a feeling aspupload will not work for that.  

My suggestion is to either follow the powershell option https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-powershell or php https://docs.microsoft.com/en-us/azure/storage/blobs/storage-quickstart-blobs-php?tabs=windows

In either case, you would set up your script to accept a parameter for the file and have your classic asp code send the data via xmlhttp request.

The php example shows
 
<?php
$uploadFile = $_POST['filename'] // THIS WILL BE YOUR FILE NAME;
$passcode = $_POST['passcode']; //POST A PASSCODE IN YOUR ASP PAGE TO PREVENT THIS FROM FIRING BY ACCIDENT

// ASSUME PASSCODE IS 'ABC123'

if $passcode != 'ABC123' {
    die('Please see the site admin');  // If wrong passcode, stop processing and print out error to screen
}


 $myfile = fopen($passcode, "w") or die("Unable to open file!");
    fclose($myfile);

    # Upload file as a block blob
    echo "Uploading BlockBlob: ".PHP_EOL;
    echo $fileToUpload;
    echo "<br />";

    $content = fopen($fileToUpload, "r");

    //Upload blob
    $blobClient->createBlockBlob($containerName, $fileToUpload, $content);

Open in new window


To modify, call the file upload.php
  $myfile = fopen("HelloWorld.txt", "w") or die("Unable to open file!");
    fclose($myfile);

    # Upload file as a block blob
    echo "Uploading BlockBlob: ".PHP_EOL;
    echo $fileToUpload;
    echo "<br />";

    $content = fopen($fileToUpload, "r");

    //Upload blob
    $blobClient->createBlockBlob($containerName, $fileToUpload, $content);

Open in new window


Now for your asp code https://support.microsoft.com/en-us/help/290591/how-to-submit-form-data-by-using-xmlhttp-or-serverxmlhttp-object
<%@ Language=vbScript%>
<%

fileToUpload = "myFile.txt"

DataToSend = "passcode=ABC123&file="&fileToUpload
dim xmlhttp 
set xmlhttp = server.Createobject("MSXML2.ServerXMLHTTP")
xmlhttp.Open "POST","http://mysite.com/upload.php",false
xmlhttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
xmlhttp.send DataToSend
Response.ContentType = "text/plain"    ' ******** CHANGED TO TEXT/PLAIN ******************
Response.Write xmlhttp.responseText   ' *********CHANGED TO RESPONSETEXT *****************
        Set xmlhttp = nothing
%>

Open in new window


If you are uploading the file to your server first, you can use aspupload to go to your own server, from there grab the file name to use in your xmlhttppost page for field fileToUpload.

If you prefer to use powershell and not instal php, you could run a powershell script using vbscript too https://blogs.technet.microsoft.com/heyscriptingguy/2012/07/18/how-to-use-vbscript-to-run-a-powershell-script/
0
AleksAuthor Commented:
Sorry if I wasn't clear.
This is a web application trying to upload the file.

The problem is not the upload mechanism. If we pick a local drive it will upload with no problem. But if I map it to the FileStorage drive, which is mapped as "Z" drive in the computer then it says the path cannot be found.
If we use the UNC path then it does find it but says credentials are incorrect.
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
You are using
Set Upload = Server.CreateObject("Persits.Upload")
Upload.LogonUser "mydomain", "Administrator", "xxxxxxxxx"

Open in new window


I wonder if the domain has to be
http://myaccount.blob.core.windows.net/mycontainer/myblob      
or
http://myaccount.blob.core.windows.net/mycontainer
or
http://myaccount.blob.core.windows.net
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

AleksAuthor Commented:
We have tried all sort of combinations. So far no luck.
Tonight we will try creating a local account and will test with that local user which should have access to the Z drive.

Will let you know of the results.
We thought the domain would be the above as you stated, only without the http:
Do you think we should try with http:  ?
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I'm not sure. I would do the same thing as you and just try different combinations though I would probably  just give up and go for the php or powershell example code since that works.

I think this is really a rest call and not sure if aspupload will work for that https://docs.microsoft.com/en-us/rest/api/storageservices/set-blob-service-properties

It may just be the x-ms-client-request-id
0
AleksAuthor Commented:
Yeah ... we will try to use the code we already have in place using a local drive Z with a local user that has permissions to see the drive.
If that doesn't work then we will try and see if we can clone the drive to another VM overnight to have a backup of the files in place.
The idea was to have a shared File Storage that both Vms could see.
0
AleksAuthor Commented:
This is a FileStorage drive that uses SMB protocol. Maybe thats the issue ... anyhow. Will let you know if using local Z drive works later tonight.
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
If you are moving it locally, it may be easier to use FileSystemObject https://www.w3schools.com/asp/met_movefile.asp

<%
dim fs
set fs=Server.CreateObject("Scripting.FileSystemObject")
fs.MoveFile "c:\web\*.gif","c:\images\"
set fs=nothing
%>

Open in new window

0
Big MontyWeb Ninja at largeCommented:
just throwing this out there for something to try...

Are you able to map the Z:\ to a virtual directory? if you can, I would try to do that, then all you have to do is set the permissions. Again, not sure if this is a possibility, but worth looking into
0
AleksAuthor Commented:
How would I go about doing that?  
You mean an IIS directory ?

If I do that how would I map to that drive in the application?  currently it points to "Z://foldername"
0
Big MontyWeb Ninja at largeCommented:
remembering from our days of working offline together, I seem to recall you having them in your setup (assuming this is for BD), so it should be easy to do...when i say "easy", that depends what kind of permissions you have to the z:\. If it's something you have full control over, then it's a matter of going to IIS and configuring it.

Here's a good video explaining how to set it up:

https://www.youtube.com/watch?v=lx7gAqloikE
0
AleksAuthor Commented:
It is for BD. Currently we are storing all attachments in drive "F", which is a local drive attached to an Azure VM.
It works perfectly. The SQL Server is now on a separate server to which the VM connects to.
The problem is that if the VM goes down for any reason we have a backup server that also connects to the SQL server, but the attached documents are still on the VM which when down cannot be retrieved.
We added a Storage Account (Azure) with File Share service, so now that shows as drive Z plugged into the VM. I can see it from windows explorer. It uses SMB to communicate with the drive which requires port 445 open, we already did this, yet when we try to write or read from that drive using either Z://path or the UNC path we can't access the drive via BD.
We can however using windows explorer.

https://azure.microsoft.com/en-us/services/storage/files/
0
Big MontyWeb Ninja at largeCommented:
w/out seeing the actual setup, it's hard to recommend anything else.  were you able to set a virtual directory (even as a test) on your z:\ drive. Try to get that configured as a good starting point. I am also always available offline as well to help out.
0
AleksAuthor Commented:
I asked for help with Azure people, if that doesn't work Ill give you a shout.  :)
0
Chinmay PatelChief Technical NinjaCommented:
I am sorry if you have already tried this, but have you try talking to ASPUpload support folks?
0
AleksAuthor Commented:
Actually Azure just confirmed that their protocol for File Storage does not currently support Web Applications.
So we went with a different approach.

I am not sure how to close this ticket without points assigned  :$
0
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
> I am not sure how to close this ticket without points assigned  

If you can, briefly explain what you did to solve your issue and why and then accept that as the solution. This will help others.
0
AleksAuthor Commented:
Since web applications cannot save to the file storage what we did was to run a windows task that would copy the files over from the server into the storage, instead of saving to the storage directly.
This means we keep a copy locally and one in the storage, which is not a bad thing since it works as a backup.
And we scheduled the script to run every 15 min. So we are only 15 min behind in the worse case scenario.
2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Development

From novice to tech pro — start learning today.