How to get Windows domain name and domain value for flutter web - dart

I need to get Platform Domain name and domain value for Windows SSO Authentication in flutter web.
Same like getting UserIdentity value in asp.net.
I tried using few packages like ntlm_request but that is returning null values .

Related

IIS hosted app triggers run time error when url contains a "-"

I have an VS2017 AspNet MVC 5 app hosted on a 2016 Server and IIS. Each client has its own website with its own copy of the web app. Using godaddy.com I forward (with keep mask checked) the client domain to the sub-domain in the IIS and everything has been working fine for years. The client can access the web app and see its domain name in the browser url.
Example: myclientdomain.com forward with mask to myclientdomain.mycompanydomain.com but shows in the browser as myclientdomain.com
Now, I have this new client whose domain is newclient-domain.com (It has a dash) and it was forwarded exactly like the others, however, after the page loads, if the user clicks the only button in the page, it triggers a runtime error saying:
"The required anti-forgery cookie "__RequestVerificationToken" is not present.]"
Since all the others don't have this error, I am inclined to think it is the dash in the domain name. Am I right? Is there any solution other than removing the dash from the domain name?

ASP.NET Core Identity for multiple project with IdentityServer4

I have one solution with two MVC projects, which use the IdentityServer4. In one project I installed the IdentityServer4 and have full access to the database. The other project is an MVC client.
When I set the [Authorize] attribute on both project all works fine, but this role attribute [Authorize(Roles = "user")] works only in project one that has the IdentityServer4, the MVC client says:
Unable to resolve service for type 'Microsoft.AspNetCore.Identity.UserManager`1[Entities.Application.ApplicationUser]' while attempting to activate 'IdMWeb.Controllers.AccountController' (this is the project one with the IdentityServer4 installed).
My questions are, why project one does not complain when I do not set the role attribute in project 2.
Also, how can project 2 get the role from the database?
please see bottom link for asp .net core apps:
Share authentication cookies path
simple answer:
please add bottom code in startup.cs ConfigureServices method of two or more ASP.NET Core projects :(be cureful the path "C:\sampleDirectoryInServer" exists in your server)
services.AddDataProtection()
.PersistKeysToFileSystem(new DirectoryInfo(#"C:\sampleDirectoryInServer"))
.SetApplicationName("SharedCookieApp");
services.ConfigureApplicationCookie(options => {
options.Cookie.Name = ".AspNet.SharedCookie";
});
it's work for me(2 asp.net core app with same database and different ports)
Based on the error message your posted, It may be that you did not define a client on the server side for this particular client. A IdentityServer instance will only accept requests from clients that it already knows about. You have to define the acceptable clients for it when you configure the middleware.

HttpContext.Current.Session is null in ASP.NET application when accessed in Internet Explorer

Working:
ASP.NET Application is hosted on IIS 8.5.
In bindings we have provided the domain name to the website.
When we try to access the website with domain name then the HttpContext.Current.Seesion throws null reference exception on Internet Explorer any version.
But the same application works fine on Chrome and Firefox.
Also it works fine in Internet Explorer without domain name i.e. with IP.
Setting the sessionstate property cookieless to AutoDetect or true web.config in fixes the issue, but the cookie with some ID is visible in URL which we want to avoid.
Can anyone please help if we are missing with any setting on IIS or another way.
Solution Found:
Removing the underscores in the URL name i.e. in DNS name.
Refer link:
Problem with Session State in Internet Explorer!

Host name Configuration on IIS7

Facing issue after applying host name. Application is working fine without the host name. Once i provide the host name for application in Bindings some of the functionality stops working like export to excel,edit.
Giving exception for [ValidateAntiForgeryToken] "The required anti-forgery cookie "__RequestVerificationToken" is not present" even it is there in controller and view. It is working absolutely fine without DNS name.
Application is created in mvc4 with Entity Framework .
Any help will be grateful...

Custom authentication : Odata services

Do you know of a way for me to create a customer authentication in Odata services? I don't want to use the default ASP.NET membership model and NetworkCredential.
I have already referred section : authentication-part-6-custom-basic-authentication.aspx. But i am not able to debug Httpmodule i.e Init() of Httpmodule
This depends on what version of IIS you are deploying/testing in.
I found that when using IIS version less than 7, your new HttpModule should be declared in System.web/HttpModules tag. In version 7 and higher, it should be in the System.webserver/Modules tag.
Within IIS, enable just anonymous authentication.

Resources