Relocating the Asp.Net WebAPI to its own domain apart from the Asp.Net MVC site in preparation for the AngularJS

We currently have an Asp.Net MVC 5.0 project that utilizes AngularJS for the front end. The project includes a WebAPI Controller within the same project and is deployed on the same website. This application was created using the Individual User Account project template and incorporates Asp.Net Identity and Claims. One of the features is a file upload module where users can upload files over 100MB, which then go through the webapi and ng-file-upload plugin. Due to a growing user base, we are looking to enhance the upload speed by separating the API into its own site on a new server for scalability purposes. The current API controller operates under ASP.NET MVC solution with OWIN cookie authentication, allowing authorization through the cookie authentication middleware. What would be the most efficient way to move the API onto a separate site? It seems that implementing OAuth token based on the MVC site and configuring the new API site to consume this token via CORS may be necessary. However, whether we need to eliminate cookie-based authentication and replace it with token-based authentication remains unclear. Are there alternative approaches that would allow us to retain cookie-based authentication for the Asp.Net MVC site while relocating the API to a new site?

In addition, we are considering building a mobile app that will interact with this API, further emphasizing the need to separate the webapi into its own site and implement OAuth token-based authorization.

Thank you for your assistance!

Best regards, Bala

Answer №1

In the scenario where your MVC site consists of only client-side code without a significant back-end in C#, security may not be a concern as long as your data is retrieved from an API that requires secure handling. However, if you prefer not to separate the client and server into different domains, using HTTPS-only encrypted cookies for user information transmission may not suffice. If the servers are on different domains and there are multiple consumers accessing the API, transitioning to OAuth and bearer token-based authentication with refresh tokens might be more suitable. This approach allows for scalable API deployment across various load balancers while maintaining statelessness through bearer tokens.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Angular image source load test encountered an error

<div class="col-xs-4 col-sm-4 col-md-4"> {{jsonData[current].profilepic}} <div ng-if=IsValidImageUrl(jsonData[current].profilepic)> <img id="pic" ng-src="{{jsonData[current].profilepic}}" alt=""/> </div> < ...

Angular connecting to the count of filtered items

Here's the array I'm working with: [ { type: "hhh", items: [ { "name": "EGFR", "type": "a", "selected": true } ] }, { type: "aaa", items: [ { ...

Issue with showing Angular directive

I've been working on implementing an angular dropdown list with Bootstrap. The functionality includes a directive that allows the user to select a menu option from the dropdown and receive an alert message. To see the implementation in action, I have ...

Unable to update the Angular scope variable directly inside an AJAX call

var request = { "RequestId": $scope.$parent.req_id, "RequestDate": new Date(), "RequestDetails": $scope.$parent.details }; $scope.request_status = "pending"; $.ajax({ type: "POST", url: ...

The reverse proxy in nginx is having trouble accessing custom paths within the loopback network

Running my loopback app on the server and attempting to access it via an nginx reverse proxy has been a challenge. Unfortunately, I'm quite new to nginx and struggling to configure it correctly. Below is a snippet from my config file /etc/nginx/sites- ...

What is the best way to implement callbacks with $http in Typescript?

When making my $http call, I am looking for the most adaptable way to handle all the parameters returned in the .success and .error functions. Here is an example of what my $http call looks like: this.$http({ url: "/api/x", method: "GET" }) .success((? ...

AngularJS has encountered an issue with a route resolve promise that has not been completely resolved

I'm currently working on a simple task to manage user roles within routes. The goal is straightforward: Verify the role of the logged-in user on each route (using a resolve function to authenticate the user based on token or login credentials) Direc ...

Using the foreach Loop in Javascript and AngularJs

Having trouble with a foreach loop because you're not sure of the column name to access specific data? Here's a solution to display all columns along with their corresponding data: angular.forEach(data, function(value, key) { console.log( &a ...

AngularJS - Changing Views with Templates

At the moment, I am changing my directives in the following manner. Within my directive: (function(){ 'use strict'; var controller = ['$scope', function ($scope) { }]; angular .module('moduleName' ...

Is there a way to automatically cancel any pending $http requests when the route changes in AngularJS?

If we want to cancel the $timeout and $interval when the route changes, we can use '$destroy'. But what about aborting any pending $http requests similar to $interval and $timeout? ...

ng-include once the application has finished loading

Currently, my server is using handlebars to generate the initial HTML page. I would like to include a ng-include in this page to dynamically update the client side. However, every time my application runs, it loads the page and the data-ng-include="templa ...

Is there a way to submit an object to the server without using ajax during form submission?

I have a web application built on the ASP.NET MVC 5 framework. One of the pages in my application utilizes the amazing jQuery-QueryBuilder plugin, allowing users to create filters to refine the dataset results. When a user submits the form by clicking the ...

Issue encountered in Angularjs during upgrade process from version 1.2.27 to 1.4.7

Recently, I upgraded my app from using AngularJS 1.2.27 to version 1.4.7, but now I am encountering an error in the AngularJS file. SyntaxError: Unexpected token : (angular.js:12477) at Function (native) at Object.sd. ...

Tips for integrating Ionic with AngularIn this guide, we'll show

My current setup involves using the ionic framework with angular. Below are snippets from the app.js and index.html files: I am facing an issue where I cannot access the logInAsFarmer function in index.html. Can someone please review my code and let me kn ...

A TypeScript Class that Refers to Itself

I need help with representing a JSON object in an Angular2 typescript class. The JSON object contains an array of objects of its own type. Here is what the JSON object looks like: { "data": { "id": 5, "type": "taxons", "attributes": { ...

Executing Cross-Origin Resource Sharing in Angular and Node

I have implemented a frontend using Node.js and AngularJS, with the backend running on Jetty exposing REST services. I need to send a REST request from the frontend (Angular) to the backend. When I pass the complete URL to $http.get it works fine. However, ...

PlatypusTS: Embracing Inner Modules

Incorporating angular, I have the capability to fetch object instances or import modules using the $injector in this manner: export class BaseService { protected $http: angular.IHttpService; protected _injector: angular.auto.IInjec ...

Displaying retrieved data following AJAX request in ASP.NET MVC is currently not functioning

I have a situation where I need to populate two <p> fields with text Below is the HTML code snippet: <p id="appId" style="visibility: hidden;"></p> <p id="calculationId" style="visibility: hidden;"></p> I am making an AJAX ...

What is the process for creating a filter to refine ng-model values in AngularJS?

One of the challenges I am facing involves an input field: <input type="text" ng-model="defaultValue"> Within my controller, the input field is initialized as an empty string: $scope.defaultValue = ""; I aim to develop a filter that can compare v ...

Struggling to integrate the c3 chart library with Angular, encountering loading issues

I've been attempting to utilize the c3 angular charts, but unfortunately nothing is displaying on my page. Despite checking for console errors and following a tutorial, I still can't seem to get anything to show up. I have cloned the git repo an ...