• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# AspNetHostingPermissionLevel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中AspNetHostingPermissionLevel的典型用法代码示例。如果您正苦于以下问题:C# AspNetHostingPermissionLevel类的具体用法?C# AspNetHostingPermissionLevel怎么用?C# AspNetHostingPermissionLevel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AspNetHostingPermissionLevel类属于命名空间,在下文中一共展示了AspNetHostingPermissionLevel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: CheckAspNetPermission

 /// <summary>
 /// 
 /// </summary>
 /// <param name="level"></param>
 /// <param name="message"></param>
 public static void CheckAspNetPermission(AspNetHostingPermissionLevel level, string message)
 {
     if (!HasAspNetPermission(level))
     {
         throw new HttpException(message);
     }
 }
开发者ID:VlaTo,项目名称:EmpRe.NET,代码行数:12,代码来源:Host.cs


示例2: CreateControl

		// LinkDemand

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// no public ctor is available but we know the Count property isn't protected
			MethodInfo mi = this.Type.GetProperty ("Count").GetGetMethod ();
			Assert.IsNotNull (mi, "Count");
			return mi.Invoke (css, null);
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:CssStyleCollectionCas.cs


示例3: CreateControl

		// LinkDemand

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// no public ctor is available but we know that it's properties don't have any restrictions
			MethodInfo mi = this.Type.GetProperty ("AcceptTypes").GetGetMethod ();
			Assert.IsNotNull (mi, "get_AcceptTypes");
			return mi.Invoke (response.Cache.VaryByHeaders, null);
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:HttpCacheVaryByHeadersCas.cs


示例4: CreateControl

		// LinkDemand

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// no public ctor but we know the properties aren't protected
			MethodInfo mi = this.Type.GetProperty ("Visible").GetGetMethod ();
			Assert.IsNotNull (mi, "Visible");
			return mi.Invoke (pager_style, null);
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:DataGridPagerStyleCas.cs


示例5: CreateControlStringCtor

		private object CreateControlStringCtor (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// not public empty (default) ctor - at least not before 2.0
			ConstructorInfo ci = this.Type.GetConstructor (new Type[1] { typeof (string) });
			Assert.IsNotNull (ci, ".ctor(string)");
			return ci.Invoke (new object[1] { tempFile });
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:CacheDependencyCas.cs


示例6: CreateControl

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			if ((level != AspNetHostingPermissionLevel.None) && (action == SecurityAction.PermitOnly))
				return UnmanagedCreateControl (action, level);
			else
				return base.CreateControl (action, level);
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:CacheCas.cs


示例7: CreateControl

		// LinkDemand

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// static class 2.0 / no public ctor before (1.x)
			MethodInfo mi = this.Type.GetMethod ("EnumToString");
			Assert.IsNotNull (mi, "EnumToString");
			return mi.Invoke (null, new object[2] { typeof(SecurityAction), SecurityAction.Demand });
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:PropertyConverterCas.cs


示例8: FromXml

 public override void FromXml(SecurityElement securityElement)
 {
     if (securityElement == null)
     {
         throw new ArgumentNullException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     if (!securityElement.Tag.Equals("IPermission"))
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     string str = securityElement.Attribute("class");
     if (str == null)
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     if (str.IndexOf(base.GetType().FullName, StringComparison.Ordinal) < 0)
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "securityElement" }));
     }
     if (string.Compare(securityElement.Attribute("version"), "1", StringComparison.OrdinalIgnoreCase) != 0)
     {
         throw new ArgumentException(SR.GetString("AspNetHostingPermissionBadXml", new object[] { "version" }));
     }
     string str3 = securityElement.Attribute("Level");
     if (str3 == null)
     {
         this._level = AspNetHostingPermissionLevel.None;
     }
     else
     {
         this._level = (AspNetHostingPermissionLevel) Enum.Parse(typeof(AspNetHostingPermissionLevel), str3);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:AspNetHostingPermission.cs


示例9: GetCurrentTrustLevel

		/// <summary>
		/// Get the current trust level of the hosted application
		/// </summary>
		/// <returns></returns>
		public static AspNetHostingPermissionLevel GetCurrentTrustLevel()
		{
		    if (_knowTrustLevel) return _trustLevel;

			foreach (var trustLevel in new[] {
			                                 	AspNetHostingPermissionLevel.Unrestricted,
			                                 	AspNetHostingPermissionLevel.High,
			                                 	AspNetHostingPermissionLevel.Medium,
			                                 	AspNetHostingPermissionLevel.Low,
			                                 	AspNetHostingPermissionLevel.Minimal })
			{
				try
				{
					new AspNetHostingPermission(trustLevel).Demand();
				}
				catch (SecurityException)
				{
					continue;
				}

                _trustLevel = trustLevel;
			    _knowTrustLevel = true;
			    return _trustLevel;
			}

			_trustLevel = AspNetHostingPermissionLevel.None;
            _knowTrustLevel = true;
            return _trustLevel;
        }
开发者ID:phaniarveti,项目名称:Experiments,代码行数:33,代码来源:SystemUtilities.cs


示例10: CreateControl

		// LinkDemand

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			ConstructorInfo ci = this.Type.GetConstructor (new Type[7] { typeof (string), typeof (string),
				typeof (int), typeof (string), typeof (string), typeof (string), typeof (BuildMethod) });
			Assert.IsNotNull (ci, ".ctor(2xstring,int,3xstring,BuildMethod)");
			return ci.Invoke (new object[7] { null, null, null, null, null, null, null });
		}
开发者ID:nobled,项目名称:mono,代码行数:9,代码来源:StaticPartialCachingControlCas.cs


示例11: AspNetHostingPermission

		public AspNetHostingPermission (PermissionState state)
		{
			if (PermissionHelper.CheckPermissionState (state, true) == PermissionState.Unrestricted)
				_level = AspNetHostingPermissionLevel.Unrestricted;
			else
				_level = AspNetHostingPermissionLevel.None;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:AspNetHostingPermission.cs


示例12: CreateControl

		// LinkDemand

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// there are no public ctor so we're taking a method that we know isn't protected
			// (by a Demand) and call it thru reflection so any linkdemand (on the class) will
			// be promoted to a Demand
			MethodInfo mi = this.Type.GetProperty ("AllKeys").GetGetMethod ();
			return mi.Invoke (appstate, null);
		}
开发者ID:nobled,项目名称:mono,代码行数:10,代码来源:HttpApplicationStateCas.cs


示例13: AspNetHostingPermission

	public AspNetHostingPermission(PermissionState state)
			{
				if(state == PermissionState.Unrestricted)
				{
					this.level = AspNetHostingPermissionLevel.Unrestricted;
				}
				else
				{
					this.level = AspNetHostingPermissionLevel.None;
				}
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:11,代码来源:AspNetHostingPermission.cs


示例14: HasTrustLevel

 public bool HasTrustLevel(AspNetHostingPermissionLevel level)
 {
     bool hasTrustLevel = true;
     try {
         new AspNetHostingPermission(level).Demand();
     }
     catch (SecurityException) {
         hasTrustLevel = false;
     }
     return hasTrustLevel;
 }
开发者ID:simplyio,项目名称:snippet-box,代码行数:11,代码来源:TrustUtility.cs


示例15: CreateControl

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			if ((level != AspNetHostingPermissionLevel.None) && (action == SecurityAction.PermitOnly)) {
				try {
					return FileIOPermissionCreateControl (action, level);
				}
				catch (TargetInvocationException tie) {
					throw tie;
				}
			} 
			else
				return CreateControlStringCtor (action, level);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:13,代码来源:CacheDependencyCas.cs


示例16: VerifyAspNetHostingPermissionLevel

        static internal void VerifyAspNetHostingPermissionLevel(AspNetHostingPermissionLevel level, string arg) {
            switch (level) {
            case AspNetHostingPermissionLevel.Unrestricted:
            case AspNetHostingPermissionLevel.High:
            case AspNetHostingPermissionLevel.Medium:
            case AspNetHostingPermissionLevel.Low:
            case AspNetHostingPermissionLevel.Minimal:
            case AspNetHostingPermissionLevel.None:
                break;

            default:
                throw new ArgumentException(arg);
            }
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:14,代码来源:aspnethostingpermission.cs


示例17: AspNetHostingPermission

        public AspNetHostingPermission(PermissionState state)
        {
            switch (state)
            {
                case PermissionState.None:
                    this._level = AspNetHostingPermissionLevel.None;
                    return;

                case PermissionState.Unrestricted:
                    this._level = AspNetHostingPermissionLevel.Unrestricted;
                    return;
            }
            throw new ArgumentException(SR.GetString("InvalidArgument", new object[] { state.ToString(), "state" }));
        }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:14,代码来源:AspNetHostingPermission.cs


示例18: CreateControl

		public override object CreateControl (SecurityAction action, AspNetHostingPermissionLevel level)
		{
			// the ctor NRE makes it more complex
			try {
				return base.CreateControl (action, level);
			}
			catch (TargetInvocationException tie) {
				// we really checking for security exceptions that occurs before a NRE can occurs
				if (tie.InnerException is NullReferenceException)
					return String.Empty;
				else
					return null;
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:14,代码来源:PassportIdentityCas.cs


示例19: HasAspNetPermission

        /// <summary>
        /// 
        /// </summary>
        /// <param name="level"></param>
        /// <returns></returns>
        public static bool HasAspNetPermission(AspNetHostingPermissionLevel level)
        {
            var set = HttpRuntime.GetNamedPermissionSet();

            if (set == null)
            {
                return true;
            }

            var permission = (AspNetHostingPermission)set.GetPermission(typeof(AspNetHostingPermission));

            if (null == permission)
            {
                return false;
            }

            return permission.Level >= level;
        }
开发者ID:VlaTo,项目名称:EmpRe.NET,代码行数:23,代码来源:Host.cs


示例20: PluginEngine

        private static string _shadowDirectory = "~/Plugins/loaded"; //this is set in web.config as probe path //used only for medium trust

        #endregion Fields

        #region Constructors

        static PluginEngine()
        {
            TrustLevel = ServerHelper.GetCurrentTrustLevel();
            if (TrustLevel == AspNetHostingPermissionLevel.Unrestricted)
            {
                _shadowDirectory = AppDomain.CurrentDomain.DynamicDirectory;
                ShadowDirectory = new DirectoryInfo(_shadowDirectory);
            }
            else
            {
                ShadowDirectory = new DirectoryInfo(HostingEnvironment.MapPath(_shadowDirectory));

            }

            PluginsDirectory = new DirectoryInfo(HostingEnvironment.MapPath(_pluginsDirectory));

            Plugins = new List<PluginInfo>();
        }
开发者ID:Console-Byte,项目名称:mobsocial,代码行数:24,代码来源:PluginEngine.cs



注:本文中的AspNetHostingPermissionLevel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Aspose类代码示例发布时间:2022-05-24
下一篇:
C# AsnType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap