How to extend ASP.Net Web Forms app adding Blazor? - asp.net

We have a large legacy web forms application.
We would like to continue to extend the functionality of it (add new pages). But we would like to stop adding more Web Forms code and instead would like to use Blazor to develop all new features going forward.
Ideally, a link from a Web Form page would redirect the browser to a page served by a Blazor app and vice-versa and the transition would be indistinguishable to the user.
Is this possible? If yes, how can it be done?
Also, what about authentication? Ideally, the user would login in our existing Web Form app and would not need to login again when transitioning to the Blazor app.

What I did:
Host the blazor application in a subfolder under the existing app:
myapp.com/oldapp
myapp.com/oldapp/blazor
You can just add links between them, If you use the same layout users should not notice.
Now because you are using the same hostname, you can issue a cookie with a JWT token on login in the old app, and because the new app runs on the same hostname the blazor app can pickup this cookie and use the token to do requests to a new backend API that is also using JWT auth.

Related

How to Authenticate .NET MVC on iFrame

I am not experienced in .NET authentication, and haven't found a specific answer for this need.
I am developing a .NET Core 2.1 MVC app which will have to run on an iframe on a different .NET Framework 4.5.1 app, which uses a FormsAuthenticationTicket when authenticating users. I have access to the main app's code, but cannot change it.
The present requirement is to automatically authenticate the iframe app, which I am developing, automatically from the main app's cookie information. On my app the login uses ASP.NET boilerplate (Abp) users and login, and the database contains the same usernames that will be using from the main app's database (different databases, same username field).
I currently haven't been able to decrypt the cookie or find a way to configure the iframe app to support this, and would appreciate if someone would kindly steer me in the right direction.

How to redirect to AngularJS app after login using ASP.Net Identity in MVC

I am working on a project where it involves the feature of Login/Authentication using ASP.Net Identity. I used SQL Server database successfully and used Role based authentication. However, after successful login, I want to redirect the user to AngularJS app's page.
For this, I have app folder in my project which consists app.js and other controller files to route.
I don't know how should I redirect to AngularJS app after users logins.
Any tips/comments would be really helpful.

AngularJS ASP .Net MVC login

I have various AngularJS single page applications running in a single ASP .net MVC project.
In one of my AngularJS SPA's I need to create a login page which would show then show another page of information when successfully logged in. The username and passwords are stored in a database.
I am very new to ASP .net and would like some advice on the best way to (using my angular form) login and have some kind of session cookie so the user remains logged in for the duration of their session.
If you build SPA you with high probability use WebAPI. Reccomended way to authenticate API user is slightly different than usual cookie authentification.
To see how it works create a new project. If you have last VS2015 go to file -> New project -> ASP.NET Web Application -> Web API (Authentification: Individual UserAccounts).
If you just return Json(someData) in your MVC contollers and already have authentification it should work fine on tradition cookie authentification.

SSO between ASP.Net and JSP

I built an ASP.Net MVC 4 application which uses forms authentication by means of a custom membership provider inheriting from the Simple Membership.
Everything is working fine, but now I have a new requirement: I need to integrate a JSP application with mine.
This means that it has to authenticate against the same user database of my application and that they should somehow share the session in order to achieve a kind of Single Sign-On among the two applications (if an user is already authenticated in the ASP.Net application, he should be able to access the JSP application without logging in again, and vice-versa).
What architecture do you suggest me to use?
I would like to change as little as possible the ASP.Net application.
Thanks!
If you need to auhtenticate accross different domains:
You can implement your own security token service (like facebook, google does) Here is some ready to use implementation: http://thinktecture.github.io/Thinktecture.IdentityServer.v2/
If the sites are running on the same domain (subdomain), then you can try to share an authentication cookie within these domains.
An explaining article: http://www.codeproject.com/Articles/106439/Single-Sign-On-SSO-for-cross-domain-ASP-NET-applic

Cross domain Authentication

Client have a site built using Wordpress. We have built a web app for them in asp.net on a subdomain. Client now wants a login to the .net web app on the homepage of their wordpress site.
Obviously this needs to be secure.
How would this cross domain auth usually be performed?
Can it be done in an iframe or is some other method preferred>
Thanks
Wing
Using iFrame could do the trick but the elegant way of doing this would be using JSON data to communicate between different domains. You must be able to modify your client's wordpress site (authentication part of it) which would send a JSON object to your asp.net application.
Then your asp.net application should decide whether the login should be successful or not looking at the JSON data sent by wordpress site. Good luck

Resources