小编k29*_*k29的帖子

Post_Logout_Redirect_Uri 在使用 azure 进行身份验证时不会重定向

使用 OWIN 和 OpenId 使用 Azure Active Directory 对我的基本 Web 应用程序的用户进行身份验证,如 Microsoft 示例项目中的 Readme.md 中所述:https : //github.com/Azure-Samples/active-directory-dotnet-webapp-打开idconnect

以下项目在我的 web.config 中:

<add key="ida:PostLogoutRedirectUri" value="https://localhost:44320/" />

Startup.Auth 如下:

    private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
    private static string tenant = ConfigurationManager.AppSettings["ida:Tenant"];
    private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];

    string authority = String.Format(CultureInfo.InvariantCulture, aadInstance, tenant);

    public void ConfigureAuth(IAppBuilder app)
    {
        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,
                Authority = authority,
                PostLogoutRedirectUri = postLogoutRedirectUri,
                RedirectUri = …
Run Code Online (Sandbox Code Playgroud)

azure owin azure-active-directory

7
推荐指数
1
解决办法
1976
查看次数

使用内存来获取字符串会产生不正确的结果

我从这里遵循解决方案: 如何从WebAssembly函数返回JavaScript字符串 ,这里: 如何从WebAssembly中的Rust返回字符串(或类似字符串)?

但是,当从内存中读取时,我没有得到预期的结果.

AssemblyScript文件,helloWorldModule.ts:

export function getMessageLocation(): string {
    return "Hello World";
 }
Run Code Online (Sandbox Code Playgroud)

index.html的:

 <script>
    fetch("helloWorldModule.wasm").then(response =>
    response.arrayBuffer()
   ).then(bytes =>
      WebAssembly.instantiate(bytes, {imports: {}})
    ).then(results => { 
        var linearMemory = results.instance.exports.memory;
        var offset = results.instance.exports.getMessageLocation();
        var stringBuffer = new Uint8Array(linearMemory.buffer, offset, 11);

        let str = '';
        for (let i=0; i<stringBuffer.length; i++) {
            str += String.fromCharCode(stringBuffer[i]);
        }
    debugger;
    });
  </script>
Run Code Online (Sandbox Code Playgroud)

这将返回32的偏移量.最后产生一个过早开始的字符串,并在"Hello World"的每个字母之间有空格:

在此输入图像描述

但是,如果我将数组更改为Int16Array,并将8添加到偏移量(即32),则偏移量为40.如下所示:

  <script>
    fetch("helloWorldModule.wasm").then(response =>
      response.arrayBuffer()
    ).then(bytes =>
      WebAssembly.instantiate(bytes, {imports: {}})
    ).then(results => { 
        var linearMemory = results.instance.exports.memory;
        var …
Run Code Online (Sandbox Code Playgroud)

javascript webassembly assemblyscript

6
推荐指数
1
解决办法
160
查看次数

ASP.NET MVC可变数量的下拉列表

请考虑以下问题和可能的答案:ASP.Net MVC多下降,单一列表,仅允许唯一选择

忽略大部分细节,我们可以看到我们可以实现1米关系的许多下拉列表,如下所示:

<%: Html.DropDownListFor(model => model.DropwdownId1,Model.DropdownEntities) %>
<%: Html.DropDownListFor(model => model.DropwdownId2,Model.DropdownEntities) %>
<%: Html.DropDownListFor(model => model.DropwdownId3,Model.DropdownEntities) %>
Run Code Online (Sandbox Code Playgroud)

DropdownId1,DropdownId2DropdownId3在性能方便地添加到模型中,当且仅当我们知道我们究竟有多少的下拉列表中会显示和回传.但是,我想实现可变数量的下拉菜单.例如,新的下拉菜单可以通过Javascript动态添加.或者,显示在视图中的下拉数量可能取决于某些变量属性model.说,model.NumberOfDropDowns.

我该如何实现呢?如何编写可以处理可变数量下拉列表的viewmodel和控制器操作?

我已经对复杂的东西进行了很多阅读,比如编辑模板和动态添加表单元素的博客文章,但我真的很难弄清楚如何做到这一点.任何帮助将不胜感激

asp.net-mvc-4

0
推荐指数
1
解决办法
553
查看次数

具有异步覆盖的同步基本方法

我有一个基类,其子项可能想要异步实现一个方法.我已经实现如下,但Visual Studio建议GetEntityName在基本同步中进行,因为它没有await任何东西.然而,这会打破孩子们.

有没有更好的办法?

  public abstract class BaseHandler
  {
        protected virtual async Task<string> GetEntityName(object entity)
        {
            return string.Empty;
        }
  }



 public class ChilldHandler: BaseHandler
 {
        protected override async Task<string> GetEntityName(object entity)
        {
            return await LongRunningService.DoSomething(entity);
        }
 }
Run Code Online (Sandbox Code Playgroud)

c# visual-studio

0
推荐指数
1
解决办法
120
查看次数