小编Mic*_*elS的帖子

使用jQuery获取CSS的内容

我有以下CSS

h1:before {
    content: "Chapter " counter(lvl1) "\000d\000a";
    counter-increment: lvl1;
    white-space: pre-wrap;
}
h1 {
    page-break-before: right;
}
Run Code Online (Sandbox Code Playgroud)

和这个HTML

<p>...</p>
<h1>A Title</h1>
<p>...</p>
Run Code Online (Sandbox Code Playgroud)

使用给定的CSS,我得到类似的东西

Chapter 1
A Title
Run Code Online (Sandbox Code Playgroud)

当我尝试使用jQuery获取文本时,我得到"A Title".是否有可能获得"第1章\n标题"?

谢谢

css jquery

9
推荐指数
1
解决办法
9483
查看次数

IdentityServer AccessTokenValidation 结果中的 Token 未激活

我使用 IdentityServerAccessTokenType.Reference和一个 API。API 无法通过以下错误日志对请求的用户进行身份验证:

info: Microsoft.AspNetCore.Hosting.Internal.WebHost[1]
      Request starting HTTP/1.0 POST http://dev.applicationname.com/api/query text/plain 36
info: IdentityModel.AspNetCore.OAuth2Introspection.OAuth2IntrospectionHandler[7]
      BearerIdentityServerAuthenticationIntrospection was not authenticated. Failure message: Token is not active.
info: IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler[7]
      Bearer was not authenticated. Failure message: Token is not active.
info: Microsoft.AspNetCore.Authorization.DefaultAuthorizationService[2]
      Authorization failed for user: (null).
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[3]
      Authorization failed for the request at filter 'Microsoft.AspNetCore.Mvc.Authorization.AuthorizeFilter'.
info: Microsoft.AspNetCore.Mvc.ChallengeResult[1]
      Executing ChallengeResult with authentication schemes ().
info: IdentityServer4.AccessTokenValidation.IdentityServerAuthenticationHandler[12]
      AuthenticationScheme: Bearer was challenged.
info: Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker[2]
      Executed action ApplicationName.Services.QueryHandler.Controllers.QueryController.PostAsync (ApplicationName.Services.QueryHandler) in 1.0248ms
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2] …
Run Code Online (Sandbox Code Playgroud)

asp.net-core identityserver4

5
推荐指数
1
解决办法
4462
查看次数

WP7上ListPicker的caliburn.micro绑定约定

我正在为一个新项目尝试使用caliburn.micro框架,但我坚持使用绑定ListPicker(工具包中的那个).当我将控件更改为简单的DropDown时,一切都按预期工作.我假设DropDown工作正常,因为这里实现了默认约定:

AddElementConvention<Selector>(Selector.ItemsSourceProperty, "SelectedItem", "SelectionChanged")
    .ApplyBinding = (viewModelType, path, property, element, convention) => {
        if (!SetBinding(viewModelType, path, property, element, convention))
            return false;

        ConfigureSelectedItem(element, Selector.SelectedItemProperty,viewModelType, path);
        ApplyItemTemplate((ItemsControl)element, property);

        return true;
    };
Run Code Online (Sandbox Code Playgroud)

ListPicker没有实现Selector,所以我试图在我的引导程序中添加一个自定义约定:

static void AddCustomConventions() {
    AddElementConvention<ListPicker>(ListPicker.ItemsSourceProperty, "SelectedItem", "SelectionChanged")
        .ApplyBinding = (viewModelType, path, property, element, convention) => {
            ConventionManager.ConfigureSelectedItem(element, ListPicker.SelectedItemProperty,viewModelType, path);
            return true;
        };
}
Run Code Online (Sandbox Code Playgroud)

不幸的是,这不起作用.你能帮我吗?

c# silverlight-toolkit windows-phone-7 caliburn.micro listpicker

4
推荐指数
1
解决办法
929
查看次数

具有SSL以及用户名和密码身份验证的自托管WCF服务

我想从控制台应用程序发布WCF服务。为了安全起见,我想通过SSL进行通信,因此我创建了一个自签名证书。为了进行身份验证,我编写了自己的UserNamePasswordValidator。不幸的是,这不起作用

到目前为止,这是我的代码:

服务器

public class Program
{
    public static void Main()
    {
        var baseAddress = new Uri("https://localhost:8080/SelfHostedUsernamePasswordService");

        using (var host = new ServiceHost(typeof(SelfHostedUsernamePasswordService), baseAddress))
        {
            var binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportWithMessageCredential);
            binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;
            binding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.Certificate;

            var endpoint = host.AddServiceEndpoint(typeof(ISelfHostedUsernamePasswordService), binding, baseAddress);

            var cf = new ChannelFactory<ISelfHostedUsernamePasswordService>(binding, endpoint.Address);
            cf.Credentials.ClientCertificate.SetCertificate(
                StoreLocation.LocalMachine,
                StoreName.My,
                X509FindType.FindByThumbprint,
                "0000000000000000000000000000000000000000");

            var metadataBehavior = new ServiceMetadataBehavior();
            metadataBehavior.HttpsGetEnabled = true;
            metadataBehavior.MetadataExporter.PolicyVersion = PolicyVersion.Policy15;
            host.Description.Behaviors.Add(metadataBehavior);

            var credentialBehavior = new ServiceCredentials();
            credentialBehavior.UserNameAuthentication.CustomUserNamePasswordValidator = new UsernamePasswordValidator();
            credentialBehavior.UserNameAuthentication.UserNamePasswordValidationMode = UserNamePasswordValidationMode.Custom;
            host.Description.Behaviors.Add(credentialBehavior);

            host.Open();

            Console.WriteLine("The …
Run Code Online (Sandbox Code Playgroud)

c# authentication ssl wcf

4
推荐指数
1
解决办法
1392
查看次数

在升级到ASP.NET MVC6 beta7之后打开现有项目的例外

我正在使用Visual Studio 2015 Community Edition并将我现有的ASP.NET MVC6应用程序更新为beta7.现在我不能再打开项目了.Visual Studio崩溃时出现以下异常:

08.09.2015 20:23:12
Crippling
System.AggregateException: One or more errors occurred. ---> Microsoft.Assumes+InternalErrorException: The specified default content type (Default) is not defined in the project item schema.
   at Microsoft.Assumes.Fail(String message, Boolean showAssert)
   at Microsoft.VisualStudio.ProjectSystem.Items.ProjectItemSchemaManagerBase.<ComputeCacheDataAsync>d__15.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.VisualStudio.ProjectSystem.Items.ProjectItemSchemaManager.<CreateSchemaFromSnapshotDataAsync>d__21.MoveNext()
   --- End of inner exception stack trace ---
---> (Inner Exception #0) Microsoft.Assumes+InternalErrorException: The specified default content type (Default) is …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core-mvc visual-studio-2015 dnvm asp.net-core

4
推荐指数
1
解决办法
1331
查看次数