ASP.NET Efficient Chat Application Approaches - c#

I have ASP.NET 4 Web Application that connects with SQL SERVER 2005/2008
I want to add a "chat" feature to my application users.
Supposing the feature will be built from scratch, what's the best efficient reasonable approach:
Using WCF web services with a Javascript timer every 3 seconds
Using ASMX web services with a javascript timer every 3 seconds
Using AJAX control from ASP.NET (Update Panel) and do a partial Post Back depending on an ASP.NET timer (server side) every 3 seconds.
Sending requests from the database to the application telling him to refresh himself when a new message is there (I don't have an idea about this approach but I think the technology exists, but I don't even know its name)
Some JQuery AJAX technologies that are outside Microsoft AJAX .NET Framework. these technologies should be able to communicate with SQL Server and be compatible with ASP.NET (Not PHP). I'm not sure about this approach.
Any other approaches or opinions.
Supposing the feature will be built depending on a previously implemented library. what are possible libraries that are totally customized and so likely to be open source. If the library will save 25% of the work time so that will be great, but I can't use a hidden code (blind DLL) if it's pretty critical even if it saves 80% of the work time.
Thanks,

You should look at SignalR - which is pretty good and less configuration required for it.
SignalR Project - http://signalr.net/
SignalR, Simple Implementation - http://rizwanahmed.net/?p=227
If you have more questions let me know...
Thanks,
Riz

Related

ASP.NET 2.0 Web Parts migration to Blazor

I'm planning to migrate a legacy ASP.NET Web Parts application to Blazor (most likely server-side).
I know that ASP.NET Web Parts won't be migrated to .NET 6 so I'm wondering if Blazor can offer something that can replace them. I need the end-user to be able to add controls to the page so every user can get tailored UI. The communication mechanism between the web parts was very important in the legacy application - for example a text box in one web part was used as filtering criteria for grid in another web part.
If Blazor can not provide replacement for ASP.NET Web Parts can you suggest something from React/Angular.
It's been a very long time since I looked at Web Parts, so I may be missing some features, but you can add and remove components dynamically in Blazor. That way, your users can set up their layout, and you can store the info, ready for re-creation next time they load the page.
As for communication between components, that's also pretty easy, as Blazor has SignalR built in. You can add a message broker to your app, and use that to pass messages around, much like MVVM messaging of you're familiar with that.
I'm not in front of my PC right now, so can't post much code, but if you look at this blog post I wrote a while back, you'll see how easy it is to do.
Hope that helps.

Can asp.net Razor Pages maintain programmable threads?

I'm coming from building Web-Interfaces from scratch (without any Framework, just HTML/PHP/CSS/JS) and I now try to "evolve". I really like using C# for all my recent projects which is why I found out about ASP.NET and Razor Pages.
I'm not sure if I understand them correctly, can I see Razor Pages ASP.NET Web-Applications as an "Application" we're used to? Which means, can I implement parallel working processing code while the user browses the site?
As an example, i plan to create a web-interface which shows continuous input data from sensors via Networking. Would this be possible, e.g. with a Thread receiving and processing data and then showing on the Website?
If not, what would the preferred framework or solution be?
I find all the tutorials to be to complex to find an answer to this question quickly.
Yes that can be done but using some technologies.To do so you can use SignalR to Notify the clients with the updated changes
Signalr:is a library for ASP.NET developers that simplifies the process of adding real-time web functionality to applications. Real-time web functionality is the ability to have server code push content to connected clients instantly as it becomes available, rather than having the server wait for a client to request new data.
https://www.asp.net/signalr
Then You can use WebAPIs for SPA or Just rest calls so as use can use the system normally and the server responds to your method execution async.
https://www.asp.net/web-api

asp.net vs asp.net mvc for a converting a WPF application

We released a WPF client server application this year . It has a client (with a few dlls ) and server on the server machine (with multiple dlls with most of our logic). The server side uses Entity Framework and the service between them is TCP /IP Windows communication foundation (WCF).
The client uses MS Prism with Mef for MVVM. The UI has a number of Datagrids for storing , saving data.
For WPF we have :
XAMl -> View Model -> Service Interface -> Server Side code -> DB
For ASP.NET , we expect to use the layers from Service Interface onwards as it is.
So , basically we need :
Website-> Logic for data handling on client Service Interface -> Server Side code -> DB
Unit testability is not a very major concern as our unit test coverage looks good on the server side (85 % covered).
I read up on ASP.NET MVC and found some tutorials that spoke about building whole applications on the MVC framework .
Our case we have more than half of the application built and only need the client side web UI with same data .
My question is : Should we go for ASP.NET Web forms or MVC ?
Web forms have native controls like GridView which can be used. MVC doesnt provide much native controls support . MVC covers the whole web app full stack. We only need the client UI website.
People around have recommended MVC since it is new and looks like the way forward but I am wondering if it would be overkill considering our requirements ( only need client). Would MVC force us to rework our whole layers even on the server side ? Will aSP.NET web forms not do this ? We want to be able to use WCF instead of doing any other http framework like webapi.
I know this question has been done to death with but these are some speicific requirements here. I also read up on porting WPF apps to Web but tat probably wont work out as we may have some fucntionalties different in the Web vs WPF.
Having worked with both MVC and Web Forms I would highly recommend going with MVC. In my opinion Web Forms is an antiquated pain-in-the ass that doesn't lend itself well to scaling or unit testing(which I know you said is not a huge concern).
Yes, Webforms has native controls like gridviews but you aren't missing out on much. These are good for very simple things but as soon as you add some complexity to your tabular data you're going to be pulling your hair out. What I'm trying to say is you can accomplish the same thing these built-in controls provide but with greater flexibility using simple tables or just plain old divs(and some css, of course).
I should also note that both MVC and web forms work just fine w/ WCF. You don't have to use WebApi if you're using MVC.
Lastly, I don't think there's an easy way of only providing "the client" piece of what your trying to accomplish with Microsoft technologies. If I understand your question correctly, you have a desktop application and now you want to provide a web-based equivalent UI. You're going to have to create a site using webforms or MVC to achieve that. However, you will be able to reuse your web services so you won't have to rewrite too much business logic.
You are making a small confusion. Since you have alredy a WCF(SOAP) backend service you will write only the UIClient, regardes of technology. You can do it even in Java.
Since you rewrite the desktop client, as a new web client you have to do it from scratch, and so should use ASP.MVC. You can find a lot of forums which can tell you why.
Web API is used, only if you want to create REST services in MVC. But you can build them also in WCF if you really need them.
The only good reason for ASP.NET, will the fact if you have developers which already know it, and you can save some money.

Needs help in defining architecture of ASP.Net web app?

I just got a project to be build up from scratch. Its front end will ASP.Net and Backend is SQL 2008. The requirement is, the architecture of the app should be such so that we can have access to app from any computers(desktop, laptop, netbooks) as handheld devices as well like smartphones, PDA's, Tablets. Also it should be plugable in nature like FB and orkut. That is in future if the client needs to attach games or third party applications, then it should be plugged in without rewriting the entire thing again. Also client needs the entire web ajaxified either using the toolkits or JQuery.
I have prior experience of ASP.Net webforms applications with tiered arcitecture. So this time keeping his all needs, i am thinking of a web app with WCF Service. But i have no idea or experience about the pluggable architecture with SOA and MVC (all three). It seems if I implement all the stuffs, it will going to be a mamoth of codes. For pluggable arch I googled and found MEF on codeplex. So finally I came up with the following things :
ASP.Net MVC
MEF
JQuery
WCF
RESTful with AJAX
XML
Guys, i really need your help, I am unable to think how to place all these stuffs together. Or is there any other best alternative you can suggest for.
Also, there is one more requirement by the client is that he want the loose coupled code, that's reason i chosen MVC, the aspx page can only have the controls and required HTML, validation and other codes should be done in the Business Layer of the app.
it will be great help.
You should take a look at Orchard: it's an ASP.Net MVC CMS system that is very pluguable. You can add a lot of functionnalities through modules, and there are a lot of modules already implemented and accessible.
Even if you do not end up using Orchard itself, taking a good look at its architecture should be a very good starting point for your app, as Orchard responds to a lot of the same requirements you have, and as it is an open source project, you can get as much inspiration from it as you want.

Database connection with Flex and C#/Asp.Net

I've started with Flex recently, I've noticed that some plugin for Visual Studio exist, instead of buying a licence for another program (Flex Builder).
I was wondering how I could manage to remotely connect to my database with a Flash/Flex application with the help of C#/Asp.Net.
If I've correctly understood what I've read in the last few days, there is basically no way to 'query' to a database with Flex 3. So I suppose there is another way by using a webservice in C# on the database server that would respond to the Http query from Flex.
Am I right or totally of the track? If you have any other thoughts about this, please share.
I prefer (and recommend) using Webservices for the communication between Flex and C#. It's easy to use, and they both support serialization, so you can easily transfer Strong-Typed Objects. More on Flex and .NET can be found at http://www.adobe.com/devnet/flex/flex_net.html
Alternatively, you could consider using WebORB. This program functions as a gateway between and Flex, and enables you to use the Flash RemoteObject API for the communication to C#. More on this can be found at http://www.adobe.com/devnet/flex/articles/flextodotnet_remoteobject.html.
You really should consider using FluorineFx.
It takes about 5 minutes to set up an will allow Flex to call your methods like a service. You can then pass classes back and forth from .NET to Flex and back.
It's also the standard form of communication by Adobe, it's free and it's super fast.
Your understanding is correct. Flex is intended for developing client-side applications, and communication with a database is done through a server-side application.
Pretty much the same as building a JavaScript application. Though, Flex has several additional options for communicating with the backend. Webservices are great in a lot of cases, but the other options are worth looking into.
Here's a pretty happening article on the topic, if you haven't already seen it.
http://www.dehats.com/drupal/?q=node/33

Categories