IIS 5 & IIS 6
Displaying images stored in SQL on a webpage
Last post Oct 31, 2007 10:45 PM by CodeJawa
Oct 30, 2007 06:18 PM|tpzguy|LINK
I'm running a C# web app and I save a scanned drivers license image to the clients hard drive. Then I need to copy it over to the server where IIS is running so that I can insert it into a SQL Server 2000 database. The drive that I save the image to is
shared and the guest internet user has access to it from the server but for some reason I keep getting the following error:
10/30/2007 5:08:26 PM: Logon failure: unknown user name or bad password.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.File.InternalCopy(String sourceFileName, String destFileName, Boolean overwrite)
Is there some sort of trick to get this functionality to work?
Code can be provided if needed....
Oct 30, 2007 09:36 PM|steve schofield|LINK
Sounds like permissions error. Do you see anything in the security event log showing denied messages? Try running Filemon from Sysinternals while running the process and see if something is being denied.
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget
Oct 31, 2007 10:45 PM|CodeJawa|LINK
Start by verifying that this is the permissions issue that it sounds like. Add "Everyone" to the access list for where the image is stored and see if it runs correctly. If it does then you know it's just a matter of setting the right permissions. Assuming
the that first step works out for you check out both the sharing and the security settings on the file location keeping in mind that they can conflict. You may, although it's somewhat unlikely, have limited the number of simultaneous accesses to the location
and you're leaving a handle open on the location so the image can't be served to the anonymous IIS request.
Assuming that the above doesn't work here's the rest of the questions:
Could you clarify what exactly your setup is? You're running a C# webapp that allows users to upload a copy of their driver's license to a machine and then to another machine which is running IIS ... Are these two separate IIS installations? What's hosting
the web app? If you do have 2 IIS installations then keep in mind that you have two different IUSR accounts since those accounts are local to the machine the installation is running on.
In general what you need to do here is break your process into finite steps that you can verify and then reassemble. Is the image stored? Once it's stored where is stored. What's the current credential running the process? Can you open a handle to the destination?
Don't try to copy all in one shot. Open a handle, verify the location, check the permissions, echo out the current credential to a log somewhere, try to manually log into the target machine with the indicated credentials. It may be tedious but it shouldn't
take too terribly long and you have a well defined path to resolve your issue.
Good luck and let us know how it turns out.