Recently I started a roadmap to move my codes from asp classic to asp.net
Everything its ok, but I have one exception and cause this, I need to maintain a piece of entire solution under asp classic.
During the tests in my new machine I discovered that the web page when run the upload of content in asp classic create the files in final folder on webserver has the user logged in IIS as owner of the file.
In asp.net all files are created by NETWORK SERVICES (and make sense, its correct), to resolve the problem I give the FULL ACCESS for authenticated users, but I know that is incorrect.
My question is, there another way to upload files in asp classic using the NETWORK SERVICES (like asp.net do)
Here piece of code in asp classic...
up.Save(up.PastaPadraoUpload)
ks = up.UploadedFiles.keys
if (UBound(ks) <> -1) then
SaveFiles = "<strong>Files uploaded:</strong> "
for each fileKey in up.UploadedFiles.keys
arquivosSalvos = arquivosSalvos & up.UploadedFiles(fileKey).FileName
next
end if
arquivoEnviado = up.PastaPadraoUpload & arquivosSalvosThe method save only open an ADO Stream and when do this, probably this is created under the connected user from IIS
'Calls Upload to extract the data from the binary request and then saves the uploaded files
Public Sub Save(path)
Dim streamFile, fileItem
if Right(path, 1) <> "\" then path = path & "\"
if not uploadedYet then Upload
For Each fileItem In UploadedFiles.Items
'Set streamFile = Server.CreateObject("ADODB.Stream")
Randomize
random = Rnd
Set streamFile = CreateObject("ADODB.Stream")
streamFile.Type = 1
streamFile.Open
StreamRequest.Position = fileItem.Start
StreamRequest.CopyTo streamFile, fileItem.Length
streamFile.SaveToFile path & random & "_" & fileItem.FileName , 2
streamFile.close
Set streamFile = Nothing
fileItem.Path = path & random & "_" & fileItem.FileName
fileItem.FileName = random & "_" & fileItem.FileName
'fileItem.Path = path & fileItem.FileName
Next
End Sub