Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- internal static object CreateInstanceFromVirtualPath(
- VirtualPath virtualPath,
- Type requiredBaseType,
- HttpContext context,
- bool allowCrossApp
- )
- {
- ITypedWebObjectFactory objectFactory = GetVirtualPathObjectFactory(virtualPath, context, allowCrossApp);
- if (objectFactory == null) return null;
- // Make sure it has the required base type (VSWhidbey 516771)
- Util.CheckAssignableType(requiredBaseType, objectFactory.InstantiatedType);
- // impersonate client while executing page ctor (see ASURT 89712)
- // (compilation is done while not impersonating client)
- Object instance;
- using (new ClientImpersonationContext(context))
- {
- instance = objectFactory.CreateInstance();
- }
- return instance;
- }
Advertisement
Add Comment
Please, Sign In to add comment