-1

We have an existing Application in ASP.Net (Aspx Pages), we are thinking to integrate new functionality in MVC. This is something that we can easily do it through the several examples available on the Internet.

Here, the main question is "What if we want to integrate MVC project with Angular?" We could not find any example or blog related to the same.

Is it possible? What are the pros and cons of it? How we can achieve it?

We are totally blank in this, any help would be appreciated.

Note: We do not have any code because we haven't found anything.

Chandresh Khambhayata
  • 1,748
  • 2
  • 31
  • 60

1 Answers1

0

You have to consider following things at least:

  • Routing (Angular has its own routing configuration which can be tweaked if needed).

  • Angular (not AngularJS) uses TypeScript. So, in your existing ASP.NET project, you have to ensure that your TypeScript files are transpiled into JS.

Since you say that the existing ASP.NET project is working, it might make sense to think about why you would like to do this, what your objectives are.

AFAIK, using Angular in ASP.NET project directly (without using MVC alongside) makes more sense.

I think you can do the following:

  1. Use Angular for client-side rendering, calling HTTP APIs and UX. Angular allows re-usable components written in TypeScript and makes architecture modular.
  2. Continue with ASP.NET for server-side processing and security.
Prasad
  • 349
  • 2
  • 6
  • In our existing asp.net application, login information is stored in Session, which seems we can not use in API project. – Chandresh Khambhayata Aug 06 '19 at 12:30
  • You can always pass on login info to an API using auth header. That said, storing sensitive login info in session is not secure. ASP.NET SimpleMembershipProvider has all the necessary mechanism to store logged-in user's details without involving session. – Prasad Aug 06 '19 at 14:54