Angular and Asp.Net WebAPI doesnt Communicate over local network - c#

My Asp.Net WebAPI running at 192.168.1.34:454546 and Angular running at 192.168.1.34:4200
when I run Angular on my pc(192.168.1.34) app works well but when i switch to another pc(for example:192.168.1.35) i can access to individuall both asp.Net WebAPI and Angular. But on page i cant see any Api data.
How can i solve this?
by the way I use Conveyor by Keyoti

The problem was my ISS service. I just enabled it from windows features. and it worked fine

Related

Consume WebAPI that uses Windows Authentication with Blazor WASM

I am searching for hours now. I have a C# Blazor WASM SPA which get its data from a C# WebAPI (netcore 3.1). For authentication I use JWT at the moment.
I want to switch to a SSO-Solution. Since everything is running in company network, I would like to use Windows Authentication.
I managed to set up the API on IIS for Windows Authentication. But I am really stuck with the Blazor App...
I tried to set it up on IIS with WinAuth/Anonym and to use a simple GET-Request for Login, hoping that NTLM negotiation would pass the credentials from the browser to the API. Would be fine for me, if all further requests would use JWT. Even better if everything would work with WinAuth.
But whatever I try, I won't work. Does anybody has a tutorial or a least a concept I could use for the start?
Take a look at https://learn.microsoft.com/en-us/aspnet/core/blazor/security/webassembly/hosted-with-azure-active-directory?view=aspnetcore-3.1.
This article shows how to secure both a Blazor front-end and .NET Core back-end api.

Web API Missing on deployment

So I have a C# MVC Web API and Web Application that is an all-in-one project. I've created something similar to this in the past but the Web Application and Web API were two different projects with two different URLs.
For example:
The Web Application would be hosted at mywebsite.com/webapp
The Web API would be hosted at mywebsite.com/webapi
Any time I wanted to call the Web API from the Web Application all I had to do is send an Ajax request using the URL mywebsite.com/webapi/api/getdata
However, with my current project it's all-in-one. So in testing I would simply call /api/getdata and it would work just fine in Visual Studio debug. But when I deploy this site for testing and actually host it all my API calls are met with HTTP 404 errors.
So how do I call the Web API when the Web API doesn't have it's own distinct URL?
In IIS I converted the folder to an application and then made sure to switch the calls from
mywebsite.com/api/getdata
to
mywebsite.com/myproject/api/getdata
and it's working now.
Credit to #mxmissile for pointing it out.

How to run ASP.NET web api from github

I am new in asp.net and angular development.I dont know how to run asp.net web api from github. As we run angular code by using "ng build --prod --base-href https://ownername.github.io/repositoryname/ so i want to know could we run asp.net web api by using such kind of any command or something other which is used for this.
Basically i want to run my project on network i tried by IIS server but no result is showing so now i want to try github process
Help would be appricated
asp.net core apps have to run in a .net core process on a server so the hosting environment needs to specifically support this. a variety of web servers can be configured to proxy the requests. Unfortunately, I don't think GitHub allows running app processes for asp.net core.
However you ca easily deploy to azure with even a free account
https://learn.microsoft.com/en-us/aspnet/core/tutorials/publish-to-azure-webapp-using-vs?view=aspnetcore-2.2

How to disable web service call tracking in Angular

I am developing a project in Angular 4.0 and using c#.net web API as back-end.
Problem is, When I am running my application through browser, I am able to see web service call (get/post) through "Postman Interceptor". Which is not good for security. Is there any way to secure my webAPI call so that it will not be visible in "Postmatser" or fiddler like tool?
Is there any way to secure my webAPI call so that it will not be visible in [Postman or Fiddler]?
No. You're issuing requests from the browser. This means they will come from the visitor's pc, and everything that happens there can be intercepted by them.
You don't need obscurity, you need authentication.

Share Authentication tokens between ASP.NET Core MVC and Angular4 app

We currently have an ASP.NET Core MVC app in combination with IdentityServer4 for authentication. The user authenticates via IdentityServer (with the HybridAndClientCredentials flow) to ADFS before it has access to the MVC application.
The SignInScheme on the MVC client is set to the values "Cookies".
We would like to extend our MVC app to host multiple Angular apps. Sometimes even more than 1 Angular app per MVC view.
The angular apps will call seperate ASP.NET Core Web API's on behalf of the user.
My question is how does the angular apps know that the user is already authenticated in the MVC application, retrieve the access token and call the API's on the user behalf?
I have been playing around with solution Scott Brady came up with but there seems no integration between the MVC app & Angular app. The Angular app will try to authenticate to identityserver and expect a callback on a particular page.
I am looking for a solution how to share the accesstokens between the MVC app and the angular apps but I am stuck. Any help is much appreciated.
If they have to sign in via the server-side hybrid flow already then the simplest way would be an endpoint in your MVC app that is cookie-secured that the client side app can call to get the access token.
Another approach is to use oidc-client-js and have the client side Angular app obtain its own token.
You could abstract this away from the client side app itself so it's easy to change the mechanism later if you need to. As it happens we use a combination of server side and client side flows and it works fine.

Categories