本文整理汇总了C#中System.Security.Util.URLString类的典型用法代码示例。如果您正苦于以下问题:C# URLString类的具体用法?C# URLString怎么用?C# URLString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
URLString类属于System.Security.Util命名空间,在下文中一共展示了URLString类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: URLString
bool IReportMatchMembershipCondition.Check(Evidence evidence, out object usedEvidence)
{
usedEvidence = null;
if (evidence != null)
{
ApplicationDirectory hostEvidence = evidence.GetHostEvidence<ApplicationDirectory>();
Url url = evidence.GetHostEvidence<Url>();
if ((hostEvidence != null) && (url != null))
{
string directory = hostEvidence.Directory;
if ((directory != null) && (directory.Length > 1))
{
if (directory[directory.Length - 1] == '/')
{
directory = directory + "*";
}
else
{
directory = directory + "/*";
}
URLString operand = new URLString(directory);
if (url.GetURLString().IsSubsetOf(operand))
{
usedEvidence = hostEvidence;
return true;
}
}
}
}
return false;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:ApplicationDirectoryMembershipCondition.cs
示例2: Url
/// <include file='doc\URL.uex' path='docs/doc[@for="Url.Url"]/*' />
public Url( String name )
{
if (name == null)
throw new ArgumentNullException( "name" );
m_url = new URLString( name );
}
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:url.cs
示例3: ApplicationDirectory
/// <include file='doc\ApplicationDirectory.uex' path='docs/doc[@for="ApplicationDirectory.ApplicationDirectory"]/*' />
public ApplicationDirectory( String name )
{
if (name == null)
throw new ArgumentNullException( "name" );
m_appDirectory = new URLString( name );
}
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:applicationdirectory.cs
示例4: UrlIdentityPermission
/// <include file='doc\URLIdentityPermission.uex' path='docs/doc[@for="UrlIdentityPermission.UrlIdentityPermission1"]/*' />
public UrlIdentityPermission( String site )
{
if (site == null)
throw new ArgumentNullException( "site" );
m_url = new URLString( site );
}
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:urlidentitypermission.cs
示例5: Url
internal Url( String name, bool parsed )
{
if (name == null)
throw new ArgumentNullException( nameof(name) );
Contract.EndContractBlock();
m_url = new URLString( name, parsed );
}
开发者ID:Clockwork-Muse,项目名称:coreclr,代码行数:8,代码来源:URL.cs
示例6: UrlMembershipCondition
public UrlMembershipCondition( String url )
{
if (url == null)
throw new ArgumentNullException( "url" );
// Parse the Url to check that it's valid.
m_url = new URLString(url, false /* not parsed */, true /* parse eagerly */);
}
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:8,代码来源:urlmembershipcondition.cs
示例7: Url
public Url( String name )
{
if (name == null)
throw new ArgumentNullException( "name" );
Contract.EndContractBlock();
m_url = new URLString( name );
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:8,代码来源:URL.cs
示例8: ParseSiteFromUrl
private static SiteString ParseSiteFromUrl(string name)
{
URLString str = new URLString(name);
if (string.Compare(str.Scheme, "file", StringComparison.OrdinalIgnoreCase) == 0)
{
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidSite"));
}
return new SiteString(new URLString(name).Host);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:Site.cs
示例9: UrlMembershipCondition
public UrlMembershipCondition( String url )
{
if (url == null)
throw new ArgumentNullException( "url" );
Contract.EndContractBlock();
// Parse the Url to check that it's valid.
m_url = new URLString(url, false /* not parsed */, true /* parse eagerly */);
if (m_url.IsRelativeFileUrl)
throw new ArgumentException(Environment.GetResourceString("Argument_RelativeUrlMembershipCondition"), "url");
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:12,代码来源:URLMembershipCondition.cs
示例10: OnDeserialized
private void OnDeserialized(StreamingContext ctx)
{
// v2.0 and beyond XML case
if (m_serializedPermission != null)
{
FromXml(SecurityElement.FromString(m_serializedPermission));
m_serializedPermission = null;
}
else if (m_url != null) //v1.x case where we read the m_site value
{
m_unrestricted = false;
m_urls = new URLString[1];
m_urls[0] = m_url;
m_url = null;
}
}
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:17,代码来源:URLIdentityPermission.cs
示例11: CompareUrls
public static bool CompareUrls(URLString url1, URLString url2)
{
if ((url1 == null) && (url2 == null))
{
return true;
}
if ((url1 == null) || (url2 == null))
{
return false;
}
url1.DoDeferredParse();
url2.DoDeferredParse();
URLString str = url1.SpecialNormalizeUrl();
URLString str2 = url2.SpecialNormalizeUrl();
if (string.Compare(str.m_protocol, str2.m_protocol, StringComparison.OrdinalIgnoreCase) != 0)
{
return false;
}
if (string.Compare(str.m_protocol, "file", StringComparison.OrdinalIgnoreCase) == 0)
{
if (!str.m_localSite.IsSubsetOf(str2.m_localSite) || !str2.m_localSite.IsSubsetOf(str.m_localSite))
{
return false;
}
}
else
{
if (string.Compare(str.m_userpass, str2.m_userpass, StringComparison.Ordinal) != 0)
{
return false;
}
if (!str.m_siteString.IsSubsetOf(str2.m_siteString) || !str2.m_siteString.IsSubsetOf(str.m_siteString))
{
return false;
}
if (url1.m_port != url2.m_port)
{
return false;
}
}
return (str.m_directory.IsSubsetOf(str2.m_directory) && str2.m_directory.IsSubsetOf(str.m_directory));
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:42,代码来源:URLString.cs
示例12: SpecialNormalizeUrl
internal URLString SpecialNormalizeUrl()
{
// Under WinXP, file protocol urls can be mapped to
// drives that aren't actually file protocol underneath
// due to drive mounting. This code attempts to figure
// out what a drive is mounted to and create the
// url is maps to.
DoDeferredParse();
if (String.Compare( m_protocol, "file", StringComparison.OrdinalIgnoreCase) != 0)
{
return this;
}
else
{
String localSite = m_localSite.ToString();
if (localSite.Length == 2 &&
(localSite[1] == '|' ||
localSite[1] == ':'))
{
String deviceName = null;
GetDeviceName(localSite, JitHelpers.GetStringHandleOnStack(ref deviceName));
if (deviceName != null)
{
if (deviceName.IndexOf( "://", StringComparison.Ordinal ) != -1)
{
URLString u = new URLString( deviceName + "/" + this.m_directory.ToString() );
u.DoDeferredParse(); // Presumably the caller of SpecialNormalizeUrl wants a fully parsed URL
return u;
}
else
{
URLString u = new URLString( "file://" + deviceName + "/" + this.m_directory.ToString() );
u.DoDeferredParse();// Presumably the caller of SpecialNormalizeUrl wants a fully parsed URL
return u;
}
}
else
return this;
}
else
{
return this;
}
}
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:48,代码来源:URLString.cs
示例13: CompareUrls
public static bool CompareUrls( URLString url1, URLString url2 )
{
if (url1 == null && url2 == null)
return true;
if (url1 == null || url2 == null)
return false;
url1.DoDeferredParse();
url2.DoDeferredParse();
URLString normalUrl1 = url1.SpecialNormalizeUrl();
URLString normalUrl2 = url2.SpecialNormalizeUrl();
// Compare protocol (case insensitive)
if (String.Compare( normalUrl1.m_protocol, normalUrl2.m_protocol, StringComparison.OrdinalIgnoreCase) != 0)
return false;
// Do special processing for file urls
if (String.Compare( normalUrl1.m_protocol, "file", StringComparison.OrdinalIgnoreCase) == 0)
{
#if !PLATFORM_UNIX
if (!normalUrl1.m_localSite.IsSubsetOf( normalUrl2.m_localSite ) ||
!normalUrl2.m_localSite.IsSubsetOf( normalUrl1.m_localSite ))
return false;
#else
return url1.IsSubsetOf( url2 ) &&
url2.IsSubsetOf( url1 );
#endif // !PLATFORM_UNIX
}
else
{
if (String.Compare( normalUrl1.m_userpass, normalUrl2.m_userpass, StringComparison.Ordinal) != 0)
return false;
if (!normalUrl1.m_siteString.IsSubsetOf( normalUrl2.m_siteString ) ||
!normalUrl2.m_siteString.IsSubsetOf( normalUrl1.m_siteString ))
return false;
if (url1.m_port != url2.m_port)
return false;
}
if (!normalUrl1.m_directory.IsSubsetOf( normalUrl2.m_directory ) ||
!normalUrl2.m_directory.IsSubsetOf( normalUrl1.m_directory ))
return false;
return true;
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:51,代码来源:URLString.cs
示例14: Equals
public bool Equals( URLString url )
{
return CompareUrls( this, url );
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:4,代码来源:URLString.cs
示例15: ParseURL
private void ParseURL()
{
lock (this)
{
if (m_element == null)
return;
String elurl = m_element.Attribute( "Url" );
if (elurl == null)
{
throw new ArgumentException(Environment.GetResourceString("Argument_UrlCannotBeNull"));
}
else
{
URLString url = new URLString(elurl);
if (url.IsRelativeFileUrl)
throw new ArgumentException(Environment.GetResourceString("Argument_RelativeUrlMembershipCondition"));
m_url = url;
}
m_element = null;
}
}
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:24,代码来源:URLMembershipCondition.cs
示例16: ApplicationDirectory
private ApplicationDirectory(URLString appDirectory)
{
this.m_appDirectory = appDirectory;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:4,代码来源:ApplicationDirectory.cs
示例17: UrlIdentityPermission
internal UrlIdentityPermission( URLString site )
{
m_unrestricted = false;
m_urls = new URLString[1];
m_urls[0] = site;
}
开发者ID:Rayislandstyle,项目名称:dotnet-coreclr,代码行数:6,代码来源:URLIdentityPermission.cs
示例18: DemandPermission
private static void DemandPermission(string codeBase, bool havePath, int demandFlag)
{
FileIOPermissionAccess pathDiscovery = FileIOPermissionAccess.PathDiscovery;
switch (demandFlag)
{
case 1:
pathDiscovery = FileIOPermissionAccess.Read;
break;
case 2:
pathDiscovery = FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read;
break;
case 3:
CreateWebPermission(AssemblyName.EscapeCodeBase(codeBase)).Demand();
return;
}
if (!havePath)
{
codeBase = new URLString(codeBase, true).GetFileName();
}
codeBase = Path.GetFullPathInternal(codeBase);
new FileIOPermission(pathDiscovery, codeBase).Demand();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:24,代码来源:RuntimeAssembly.cs
示例19: VerifyCodeBaseDiscovery
private void VerifyCodeBaseDiscovery(string codeBase)
{
if ((codeBase != null) && (string.Compare(codeBase, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) == 0))
{
URLString str = new URLString(codeBase, true);
new FileIOPermission(FileIOPermissionAccess.PathDiscovery, str.GetFileName()).Demand();
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:RuntimeAssembly.cs
示例20: InternalLoadAssemblyName
internal static RuntimeAssembly InternalLoadAssemblyName(AssemblyName assemblyRef, System.Security.Policy.Evidence assemblySecurity, ref StackCrawlMark stackMark, bool forIntrospection, bool suppressSecurityChecks)
{
if (assemblyRef == null)
{
throw new ArgumentNullException("assemblyRef");
}
assemblyRef = (AssemblyName) assemblyRef.Clone();
if (assemblySecurity != null)
{
if (!AppDomain.CurrentDomain.IsLegacyCasPolicyEnabled)
{
throw new NotSupportedException(Environment.GetResourceString("NotSupported_RequiresCasPolicyImplicit"));
}
if (!suppressSecurityChecks)
{
new SecurityPermission(SecurityPermissionFlag.ControlEvidence).Demand();
}
}
string strA = VerifyCodeBase(assemblyRef.CodeBase);
if ((strA != null) && !suppressSecurityChecks)
{
if (string.Compare(strA, 0, "file:", 0, 5, StringComparison.OrdinalIgnoreCase) != 0)
{
CreateWebPermission(assemblyRef.EscapedCodeBase).Demand();
}
else
{
URLString str2 = new URLString(strA, true);
new FileIOPermission(FileIOPermissionAccess.PathDiscovery | FileIOPermissionAccess.Read, str2.GetFileName()).Demand();
}
}
return nLoad(assemblyRef, strA, assemblySecurity, null, ref stackMark, true, forIntrospection, suppressSecurityChecks);
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:33,代码来源:RuntimeAssembly.cs
注:本文中的System.Security.Util.URLString类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论