Инструменты пользователя

Инструменты сайта


comment66

Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

comment66 [2018/04/13 22:43] (текущий)
Строка 1: Строка 1:
 +В [[Ax40 | ]] 
 +In 4.0 we have added code access security (CAS) to the run-time.  
 +So by  
 +default most of the calls that are I/O or process bound demand  
 +that the code  
 +making the call has the right permission to make the I/O or  
 +process boiund  
 +call. Using a COM component is bound to a different process so  
 +the runtime  
 +demand that the code enforces the InteropPermission check and  
 +checks if the  
 +current user has the permission. ​  
 +  
 +So you've got to create and assert this interopPermission in your  
 +code just  
 +before you make the COM call. Here's how you do it below: 
 +  
 +------------------------------------- 
 +COM com; 
 +InteropPermission permission = new  
 +InteropPermission(InteropKind::​ComInterop);​ 
 +
 +  
 +permission.assert();​ 
 +com = new COM(namespace.classname);​ 
 +com.SomeMethod();​ 
 +CodeAccessPermission::​revertAssert();​ 
 +--------------------------------------------
comment66.txt · Последние изменения: 2018/04/13 22:43 (внешнее изменение)