Uncategorized

Avoid UAC prompt in IE component

Wow, this has been a tough one I closed this afternoon. The customer has developed a custom IE toolbar to interact with their portal, and found that when running this on Vista, IE displayed a warning dialog asking the user’s consent to run an external program; in particular that was happening when the toolbar was calling a Web Service to retrieve some content from the web server. If for test we denied the permission to run the external problem, we got this error message: “System.Runtime.InteropServices.ExternalException: Cannot execute a program. The command being executed was “C:\Windows\Microsoft.NET\Framework\v2.0.50727\csc.exe” /noconfig /fullpaths @”C:\Users\Vista\AppData\Local\Temp\Low\ev4a0rzg.cmdline“.” The exception occurred when the SOAP client proxy tries to spawn the compiler to generate the type serialization assemblies the first time the web service is called.

After the usual log analysis we setup a repro in a virtual machine, and we found that this was not an UAC issue but rather an IE Protected Mode problem (by the way, Protected Mode in IE is currently available only on Vista, so maybe this is why the customer thought to this as an UAC issue); this was confirmed by turning off Protected Mode for a test, and the prompt to the user disappeared. IE was prompting the user because when the toolbar calls the remote Web Service, the CLR needs to generate and compile on the fly the needed serialization assembly, and here is where we were failing. To resolve this we used sgen.exe from the .NET framework SDK: this allows to pre-generate the serialization assemblies, so at runtime the CLR has no need to create them on the fly (and therefore IE does not prompt the user anymore).

After that everything was running file on the virtual machine we used for your tests, but on the real customer’s machine we again got an error, this time it was “Could not find a part of the path ‘C:\Users\account\AppData\Local\Microsoft\Windows\Temporary Internet Files\Virtualized\C\Users\account\AppData\Local\Temp\Low\6br1dtzk.tmp’“; another dig into the logs, and then we found that the customer was missing a part of the path where IE stores it’s temporary files (%userprofile%\AppData\Local\Temp\Low); for some reason he was missing the “Low” folder and IE was prompting the user to ask permission to create it.

Here are a couple of links to use as a reference:

 

Carlo

Quote of the Day:
Perhaps the best thing about the future is that it comes one day at a time.
–Dean Acheson

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.