.NET Server Sent Events with Reactive Extensions [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I'm trying to implement SSE (Server Sent Events) model with client an IHM in HTML5/JS and server side C#. I'm using a COTS that implements a event driven http server with Reactive Extensions in .NET.
Client SIDE
var evtSource = new EventSource("http://127.0.0.1:4444");
source.onmessage = function(event)
{
document.getElementById("result").innerHTML += event.data + "<br>";
};
1.The browser tolds me "Cross-Origin Request" has been refused. I'm on the same domain, is it normal?
2.Is it possible to adapt this http server to do SSE? If this is not possible, do you know some .NET libs (no copyleft) implementing SSE server side?
Thanks for your consideration.

The cross-origin can be fixed by adding "Origin:*" tot the headers. This can be done in different places depending on your architecture. With MVC it can be set in the global.asax. When using owin auth you can set it where you configure the authentication with this line: config.EnableCors(); I'm sure there is a lot to find when googling 'cross-origin'.
I'm not familiar with SSE. But if it is not working out for you you can check out SignalR.(http://www.asp.net/signalr/overview/guide-to-the-api/hubs-api-guide-net-client)
I found it very easy to implement when i was building a website with chat functionality.

Related

How to call http azure functions via http requests in asp.net core? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I have one HTTP Post API (build in ASP.NET Core), that API is responsible to add Customer in database.I would like to send an email using Azure function at the time of HTTP Post request. Azure function should automatically get triggered. How to achieve this?
Why is it important to you that this is achieved by an Azure function? Azure Logic Apps were designed with such workflows in mind.
However, if it's important to you that this is implemented by an Azure Function then you'll need to create a new Azure Function with a Http Trigger. You'll need to implement the e-mail sending functionality yourself using a library such as MailKit.
Here's a good resource on using MailKit to send e-mails.

client/server authentiation: React client with C# web api [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I had an app that used an MVC template, prescaffolded with authentication (the one with bootstrap). I am migrating the project over to Web API and a React Client, but I still need this same functionality. The MVC authentication used SQL Server. I really want to do all I can the same, unless something better is possible. How can I implement authentication/authorization with Web API? I guess I can store the password in React's state/props, and then maybe pass that into the HTTP calls?
You can generate token using web api and then store it on react front-end in local storage. And whenever you do http call put that token in authorization header and match it from web api backend.

.NET Core API Gateway [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've got some work to do for school around Microservices.
I've got the architectural concept, but need an implementation to show off. I'll be using angular2 as a client, would like to use a .NET core API gateway to dispatch my requests to different services.
What's the best approach for this? I red something about using Rx.Net, but no definitive example or implementation that I can follow.
So what should I do to implement an API gateway in .NET Core?
This may or may not help but I am currently building an API gateway in .NET core.
You can find it at https://github.com/TomPallister/Ocelot.
The code is a little ropey but a few people are working on it now so hopefully we can improve it over time.
You want to have a server that listens to the incoming API calls, e.g. a HttpListener.
Inside the handler of incoming requests, you peek into the request and decide where the API call needs to be relayed.
Then you use something like a HttpClient to make another request to the actual API endpoint (mimicking the original request as closely as possible) and you relay its response back to the user.
It should all be in the listener's request handler, and the response to the original request is the response from the real API.
See MSDN docs on HttpListener.
Also a good read: Handling multiple requests with C# HttpListener

how to implement facebook realtime notification using c# [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I want to implement a notification feature i.e. user gets notification just like facebook when database is updated. I want to implement this feature in c#, can anyone help me out?
Thanks
You can use SignalR for real-time web features.
ASP.NET SignalR is a new library for ASP.NET developers that makes developing real-time web functionality easy. SignalR allows bi-directional communication between server and client. Servers can now push content to connected clients instantly as it becomes available. SignalR supports Web Sockets, and falls back to other compatible techniques for older browsers. SignalR includes APIs for connection management (for instance, connect and disconnect events), grouping connections, and authorization.

How can I setup an SSL environment to test C# remoting? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Our customer has asked that our application be able to communicate through HTTPS. The application itself is a C#.NET application, a client/server/database sort of application. My understanding from my programmer is that this is an additional layer of unnecessary encryption, but because our customer has asked for it we're going to try to provide it anyway.
What I'm looking for is a way to setup an SSL environment that does not require me to install a webserver. Although we could recompile our server into a DLL that could allow us to be hosted through IIS, the idea doesn't exactly thrill me (we're not wanting our customer to have to implement IIS in addition to our solution).
In any case, the idea is to provide an SSL tunnel over port 443 that our C#.NET remoting packets (they're http packets at the moment) may pass through.
Does anybody have any suggestions which may prove helpful in this regard? Do we need to add any additional handling to the communication process to allow this? (My gut says no, but I'm not the programmer.)
Mike
Check out this article on MSDN:
.NET Remoting: Writing an Asymmetric Encryption Channel Sink
First header is 'Support For HTTPS'

Categories