https://docs.microsoft.com/zh-tw/aspnet/core/security/authentication/identity?view=aspnetcore-3.1&tabs=visual-studio#adddefaultidentity-and-addidentity
AddDefaultIdentity已在 ASP.NET Core 2.1 中引進。 呼叫AddDefaultIdentity類似于呼叫下列內容:AddIdentity、AddDefaultUI、AddDefaultTokenProviders
原始碼
https://github.com/aspnet/Identity/blob/c7276ce2f76312ddd7fccad6e399da96b9f6fae1/src/UI/IdentityServiceCollectionUIExtensions.cs#L49
ref:
https://docs.microsoft.com/zh-tw/aspnet/core/security/authorization/secure-data?view=aspnetcore-3.1
2020年5月31日 星期日
2020年5月23日 星期六
libphonenumber-csharp
https://github.com/twcclegg/libphonenumber-csharp
檢查電話號碼格式是否正確
還會顯示分類:FIXED_LINE、MOBILE、VOIP(070門號)、TOLL_FREE(080門號)
DEMO:
https://libphonenumber.appspot.com
Java原版:
https://github.com/google/libphonenumber
ref:
https://www.twilio.com/blog/validating-phone-numbers-effectively-with-c-and-the-net-frameworks
https://medium.com/frochu/libphonenumber-example-app-f60680faa599
檢查電話號碼格式是否正確
還會顯示分類:FIXED_LINE、MOBILE、VOIP(070門號)、TOLL_FREE(080門號)
DEMO:
https://libphonenumber.appspot.com
Java原版:
https://github.com/google/libphonenumber
ref:
https://www.twilio.com/blog/validating-phone-numbers-effectively-with-c-and-the-net-frameworks
https://medium.com/frochu/libphonenumber-example-app-f60680faa599
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' while attempting to activate
寫.NET Core遇到Unable to resolve service for type通常是忘記註冊物件給DI容器
Startup.cs的ConfigureServices(IServiceCollection services)加入以下這一行
//TagsHelper使用
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
錯誤訊息:
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' while attempting to activate
Startup.cs的ConfigureServices(IServiceCollection services)加入以下這一行
//TagsHelper使用
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
錯誤訊息:
InvalidOperationException: Unable to resolve service for type 'Microsoft.AspNetCore.Mvc.Infrastructure.IActionContextAccessor' while attempting to activate
訂閱:
文章 (Atom)