本文整理汇总了C#中System.Security.Util.URLString类的典型用法代码示例。如果您正苦于以下问题:C# URLString类的具体用法?C# URLString怎么用?C# URLString使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
URLString类属于System.Security.Util命名空间,在下文中一共展示了URLString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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 );
}
示例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 );
}
示例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 );
}
示例5: Url
internal Url( String name, bool parsed )
{
if (name == null)
throw new ArgumentNullException( nameof(name) );
Contract.EndContractBlock();
m_url = new URLString( name, parsed );
}
示例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 */);
}
示例7: Url
public Url( String name )
{
if (name == null)
throw new ArgumentNullException( "name" );
Contract.EndContractBlock();
m_url = new URLString( name );
}
示例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);
}
示例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");
}
示例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;
}
}
示例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));
}
示例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;
}
}
}
示例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;
}
示例14: Equals
public bool Equals( URLString url )
{
return CompareUrls( this, url );
}
示例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;
}
}