本文整理汇总了C#中PathString类的典型用法代码示例。如果您正苦于以下问题:C# PathString类的具体用法?C# PathString怎么用?C# PathString使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PathString类属于命名空间,在下文中一共展示了PathString类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LDAPAuthenticationOptions
//TODO: Include/exclude lists for claims?
public LDAPAuthenticationOptions()
: base(LDAPAuthenticationDefaults.AuthenticationType)
{
AntiForgeryCookieName = AntiForgeryConfig.CookieName;
AntiForgeryFieldName = LDAPAuthenticationDefaults.AntiForgeryFieldName;
AuthenticationMode = AuthenticationMode.Active;
CallbackPath = new PathString("/signin-activedirectoryldap");
Caption = LDAPAuthenticationDefaults.Caption;
ClaimTypes = new List<string>();//defaults?
DomainKey = LDAPAuthenticationDefaults.DomainKey;
//Domains = new List<DomainCredential>();
PasswordKey = LDAPAuthenticationDefaults.PasswordKey;
ReturnUrlParameter = LDAPAuthenticationDefaults.ReturnUrlParameter;
StateKey = LDAPAuthenticationDefaults.StateKey;
UsernameKey = LDAPAuthenticationDefaults.UsernameKey;
ValidateAntiForgeryToken = true;
RequiredClaims = new ReadOnlyCollection<string>(new List<string>
{
AntiForgeryConfig.UniqueClaimTypeIdentifier,
ClaimsIdentity.DefaultNameClaimType,
ClaimsIdentity.DefaultRoleClaimType,
ClaimTypesAD.DisplayName,
ClaimTypesAD.Domain,
ClaimTypesAD.Guid,
System.Security.Claims.ClaimTypes.NameIdentifier,
System.Security.Claims.ClaimTypes.PrimarySid
});
}
示例2: BuildAbsolute
/// <summary>
/// Combines the given URI components into a string that is properly encoded for use in HTTP headers.
/// Note that unicode in the HostString will be encoded as punycode.
/// </summary>
/// <param name="scheme">http, https, etc.</param>
/// <param name="host">The host portion of the uri normally included in the Host header. This may include the port.</param>
/// <param name="pathBase">The first portion of the request path associated with application root.</param>
/// <param name="path">The portion of the request path that identifies the requested resource.</param>
/// <param name="query">The query, if any.</param>
/// <param name="fragment">The fragment, if any.</param>
/// <returns></returns>
public static string BuildAbsolute(
string scheme,
HostString host,
PathString pathBase = new PathString(),
PathString path = new PathString(),
QueryString query = new QueryString(),
FragmentString fragment = new FragmentString())
{
var combinedPath = (pathBase.HasValue || path.HasValue) ? (pathBase + path).ToString() : "/";
var encodedHost = host.ToString();
var encodedQuery = query.ToString();
var encodedFragment = fragment.ToString();
// PERF: Calculate string length to allocate correct buffer size for StringBuilder.
var length = scheme.Length + SchemeDelimiter.Length + encodedHost.Length
+ combinedPath.Length + encodedQuery.Length + encodedFragment.Length;
return new StringBuilder(length)
.Append(scheme)
.Append(SchemeDelimiter)
.Append(encodedHost)
.Append(combinedPath)
.Append(encodedQuery)
.Append(encodedFragment)
.ToString();
}
示例3: StaticFileContext
public StaticFileContext(HttpContext context, StaticFileOptions options, PathString matchUrl)
{
_context = context;
_options = options;
_matchUrl = matchUrl;
_request = context.Request;
_response = context.Response;
_method = null;
_isGet = false;
_isHead = false;
_subPath = PathString.Empty;
_contentType = null;
_fileInfo = null;
_length = 0;
_lastModified = new DateTime();
_etag = null;
_etagQuoted = null;
_lastModifiedString = null;
_ifMatchState = PreconditionState.Unspecified;
_ifNoneMatchState = PreconditionState.Unspecified;
_ifModifiedSinceState = PreconditionState.Unspecified;
_ifUnmodifiedSinceState = PreconditionState.Unspecified;
_ranges = null;
}
示例4: WinAuthenticationOptions
public WinAuthenticationOptions()
: base(Constants.DefaultAuthenticationType)
{
Description.Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/windowsAuth");
AuthenticationMode = AuthenticationMode.Active;
}
示例5: Map
/// <summary>
/// Branches the request pipeline based on matches of the given request path. If the request path starts with
/// the given path, the branch is executed.
/// </summary>
/// <param name="app">The <see cref="IApplicationBuilder"/> instance.</param>
/// <param name="pathMatch">The request path to match.</param>
/// <param name="configuration">The branch to take for positive path matches.</param>
/// <returns>The <see cref="IApplicationBuilder"/> instance.</returns>
public static IApplicationBuilder Map(this IApplicationBuilder app, PathString pathMatch, Action<IApplicationBuilder> configuration)
{
if (app == null)
{
throw new ArgumentNullException(nameof(app));
}
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
if (pathMatch.HasValue && pathMatch.Value.EndsWith("/", StringComparison.Ordinal))
{
throw new ArgumentException("The path must not end with a '/'", nameof(pathMatch));
}
// create branch
var branchBuilder = app.New();
configuration(branchBuilder);
var branch = branchBuilder.Build();
var options = new MapOptions
{
Branch = branch,
PathMatch = pathMatch,
};
return app.Use(next => new MapMiddleware(next, options).Invoke);
}
示例6: UseStatusNamePagesWithReExecute
/// <summary>
/// Adds a StatusCodePages middle-ware to the pipeline. Specifies that the response body should be generated by
/// re-executing the request pipeline using an alternate path. This path may contain a '{0}' placeholder of the
/// status code and a '{1}' placeholder of the status name.
/// </summary>
/// <param name="application">The application.</param>
/// <param name="pathFormat">The string representing the path to the error page. This path may contain a '{0}'
/// placeholder of the status code and a '{1}' placeholder of the status description.</param>
/// <returns>The application.</returns>
public static IApplicationBuilder UseStatusNamePagesWithReExecute(
this IApplicationBuilder application,
string pathFormat)
{
return application.UseStatusCodePages(
async context =>
{
var statusCode = context.HttpContext.Response.StatusCode;
var status = (HttpStatusCode)context.HttpContext.Response.StatusCode;
var newPath = new PathString(string.Format(
CultureInfo.InvariantCulture,
pathFormat,
statusCode,
status.ToString()));
var originalPath = context.HttpContext.Request.Path;
// Store the original paths so the application can check it.
context.HttpContext.SetFeature<IStatusCodeReExecuteFeature>(new StatusCodeReExecuteFeature()
{
OriginalPathBase = context.HttpContext.Request.PathBase.Value,
OriginalPath = originalPath.Value,
});
context.HttpContext.Request.Path = newPath;
try
{
await context.Next(context.HttpContext);
}
finally
{
context.HttpContext.Request.Path = originalPath;
context.HttpContext.SetFeature<IStatusCodeReExecuteFeature>(null);
}
});
}
示例7: WSO2AuthenticationOptions
public WSO2AuthenticationOptions() : base(Constants.DefaultAuthenticationType)
{
Caption = Constants.DefaultAuthenticationType;
CallbackPath = new PathString("/signin-wso2");
AuthenticationMode = AuthenticationMode.Passive;
BackchannelTimeout = TimeSpan.FromSeconds(60);
}
示例8: KentorAuthServicesAuthenticationOptions
public KentorAuthServicesAuthenticationOptions()
: base(Constants.DefaultAuthenticationType)
{
AuthenticationMode = AuthenticationMode.Passive;
Description.Caption = Constants.DefaultCaption;
MetadataPath = new PathString(Constants.DefaultMetadataPath);
}
示例9: RulesEndpoint
public RulesEndpoint(
IRuleData ruleData)
{
_ruleData = ruleData;
_draftRulesPath = new PathString("/rules");
_versionRulesPath = new PathString("/rules/{version}");
}
示例10: LowCalorieAuthenticationServerOptions
public LowCalorieAuthenticationServerOptions()
: base("LowCalorieAuthentication")
{
this.AuthenticationMode = AuthenticationMode.Passive;
TokenEndpointPath = new PathString("/token2");
GernerateLocalToken = false;
}
示例11: Test
public TestRunner Test(Func<HttpContext, Func<Task>, Task> test)
{
var path = new PathString("/test");
actions[path] = test;
return this;
}
示例12: Setup
public TestRunner Setup(Func<HttpContext, Func<Task>, Task> setup)
{
var path = new PathString("/setup");
actions[path] = setup;
return this;
}
示例13: GetSecuritiesAsync
public static async Task<SecurityCollection> GetSecuritiesAsync(this IMarketsFeature feature, string value) {
var path = new PathString("/v1/markets/search").Add(new {
q = value
});
return await feature.Client.GetAsync<SecurityCollection>(path);
}
示例14: OpenIdConnectOptions
public OpenIdConnectOptions(string authenticationScheme)
{
AuthenticationScheme = authenticationScheme;
DisplayName = OpenIdConnectDefaults.Caption;
CallbackPath = new PathString("/signin-oidc");
Events = new OpenIdConnectEvents();
}
示例15: SteamAuthenticationOptions
public SteamAuthenticationOptions()
{
ProviderDiscoveryUri = "http://steamcommunity.com/openid/";
Caption = "Steam";
AuthenticationType = "Steam";
CallbackPath = new PathString("/signin-openidsteam");
}