I already have working code that binary reads a file and returns it so I can have .asp links do things like return images (and do stuff like create an audit trail, enforce permissions, have different links for different groups of people, and so on).
The trick is that I need to do so using a particular domain user name. I can't run the IIS process itself using the domain user credentials for various reasons. (It's a non-person domain user that's okay for admin-type people to see the password in a source ASP, for example.)
XP has the "runas" command but that doesn't do me any good as far as I can see--there's no way to make that return what I need.
Before I go and create my own DLL that uses an alternate username/password and returns the binary contents of a file to my page, I wonder if anyone already knows how to use authentication with an ADO Stream reading from a windows file share. There IS no connection string to specify the username and password, as far as I can tell.
Or, if not ADO Stream, any method, with integrated authentication username & password specified, to get a file's binary contents into a variable. I can take the rest from there.
Here's some stripped-down working code for retrieving the file. Don't worry about hacking at the moment since I won't actually be using the filename later, but for testing now I just need the process working.
Cum catapultae proscriptae erunt tum soli proscript catapultas habebunt.
The trick is that I need to do so using a particular domain user name. I can't run the IIS process itself using the domain user credentials for various reasons. (It's a non-person domain user that's okay for admin-type people to see the password in a source ASP, for example.)
XP has the "runas" command but that doesn't do me any good as far as I can see--there's no way to make that return what I need.
Before I go and create my own DLL that uses an alternate username/password and returns the binary contents of a file to my page, I wonder if anyone already knows how to use authentication with an ADO Stream reading from a windows file share. There IS no connection string to specify the username and password, as far as I can tell.
Or, if not ADO Stream, any method, with integrated authentication username & password specified, to get a file's binary contents into a variable. I can take the rest from there.
Here's some stripped-down working code for retrieving the file. Don't worry about hacking at the moment since I won't actually be using the filename later, but for testing now I just need the process working.
Code:
Dim sPath
Dim sFileName
sPath = Request.QueryString("path")
sFileName = Request.QueryString("filename")
If sPath = "" Then
sPath = "Error-nodocumentinfo.png"
End If
If sFileName = "" Then sFileName = Int(Rnd * 1000000000)
Dim oStream
Set oStream = Server.CreateObject("ADODB.Stream")
oStream.Type = 1 ' 1=binary 2=text
oStream.Open
oStream.LoadFromFile sPath
oStream.Position = 0 'may be unnecessary
Response.Clear
Response.AddHeader "Content-Disposition", "inline; filename=" & EscapeFileName(sFileName) & ".tif"
Response.AddHeader "Content-Length", oStream.Size
Response.BinaryWrite oStream.Read
Response.Flush
oStream.Close
Set oStream = Nothing
Cum catapultae proscriptae erunt tum soli proscript catapultas habebunt.