/*
* Compile an .ascx file into a UserControl derived Type
*/
internal static Type GetCompiledUserControlType(string virtualPath,
string inputFile, HttpContext context)
{
CheckUserControlFileExtension(virtualPath);
// We need unrestricted permission to process the UserControl file
InternalSecurityPermissions.Unrestricted.Assert();
UserControlParser parser = new UserControlParser();
Type t = null;
// Suspend client impersonation (for compilation)
HttpContext.ImpersonationSuspendContext ictx = context.Impersonation.SuspendIfClient();
try {
try {
t = parser.GetCompiledType(virtualPath, inputFile, context);
}
finally {
// Resume client impersonation
ictx.Resume();
}
}
catch { throw; } // Prevent Exception Filter Security Issue (ASURT 122835)
return(t);
}