我有Net.Framework共享同样内置几个工作ASP NET应用程序machineKey在Web.config中,所以当用户在一个应用程序验证,其他应用程序认为他认证为好.
现在我必须为这个使用asp net Core 2.0的俱乐部打造一个新的应用程序.有关如何转换现有"遗产"的快速解决方案吗?
<system.web>
...
<machineKey decryption="AES" decryptionKey="blablabla" validation="SHA1" validationKey="blablabla" />
</system.web>
Run Code Online (Sandbox Code Playgroud)
要在Core应用程序中使用?
编辑:实际的Net.Framework api使用基于令牌的身份验证:
using Microsoft.Owin;
using Microsoft.Owin.Security.OAuth;
private void ConfigureOAuth(IAppBuilder app)
{
OAuthBearerOptions = new OAuthBearerAuthenticationOptions();
//Token consumption from header "Authentication Bearer"
app.UseOAuthBearerAuthentication(OAuthBearerOptions);
}
Run Code Online (Sandbox Code Playgroud)
然后在[Authorize]框架上使用机器密钥解码令牌.我猜的正确问题是如何使用手动提供的机器密钥在Core 2.0+中实现相同的解密头中发送的身份验证令牌.
我在 Xamarin.Android 项目(本机)中有 4 个选项卡。本机加载了 3 个选项卡,但我加载的一个选项卡是表单页面(内容页面)。这是选项卡的代码-
public override Android.Support.V4.App.Fragment GetItem(int position)
{
switch (position)
{
case 0:
return new tab1Fragment();
case 1:
return new tab2Fragment();
case 2:
return new tab3Fragment();
case 3:
var fragment = new FormsPage1().CreateSupportFragment(Android.App.Application.Context);
return fragment;
default:
return null;
}
}
Run Code Online (Sandbox Code Playgroud)
表单页面已成功加载,但是当我触摸该页面中的任何位置时,它会崩溃。这是例外情况-
System.NullReferenceException: Object reference not set to an instance of an object.
at Android.Views.View.n_DispatchTouchEvent_Landroid_view_MotionEvent_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_e)
at (wrapper dynamic-method) System.Object.55(intptr,intptr,intptr)
Unhandled Exception from source=AndroidEnvironment
System.NullReferenceException: Object reference not set to an …Run Code Online (Sandbox Code Playgroud)