Framework Similar to ASP.Net AjaxPro - asp.net

Currently, I'm using AjaxPro Framework (http://www.ajaxpro.info/) to call any methods in my web application from the client side.
But users have some serious problems using it. (e.g success callbacks don't work in Chrome. More info about the problems could be found at: AjaxPro is working locally, but on server I am getting .ashx errors)
I'd like to replace it with a framework that can:
Call any method in my code behind. Even if it's defined in a class library. In AjaxPro I could define a method anywhere and add [AjaxPro.AjaxMethod] attribute to it. Now the method could be called in any client-side js code, even if they were in two different classes.
Doen's depend on web forms. I could replace AjaxPro with ASP.Net Ajax by using ScriptManager and Add [WebMethod] attribute to my methods and call any other method in my solution from that page method. But I'm using .ascx files and Page methods cannot be defined in .ascx files (They have to be defined in .aspx web forms).
Preferably free. (I'd like to use it in YetAnotherForum project development). But if only a paid framework is available, I'll be glad to pay for it.
Is there any other Ajax framework which has the AjaxPro functionality?

I would recommend using jQuery. It is becoming the client javascript API to use. Even Microsoft seems to be inclining towards it in favor of their AJAX client side APIs. You can call any method in a page using the .ajax method, sample here. I have never tried it inside a UserControl, but as long as the method is decorated with a WebMethod attribute, I don't see why it wouldn't work.

I believe you have a fair choice.
Look at http://ajaxpatterns.org/DotNet_Ajax_Frameworks#Lists
At my new job we're using ajaxpro, however I also have come across issues and am currently researching alternatives.

Related

Making calls to a Stand-Alone Web API to populate ViewModels in ASP.NET MVC

Lets say I have a standalone ASP.NET Core Web API as its own project (since I don't want to merge it w/ my MVC app)
I now want to create an MVC web application (another project, but same solution) that will make calls to the API. I am aware that for ajax requests I will directly call the API through JavaScript which is straight forward.
However, I am a bit confused as to how the MVC controller would make calls to the same API to populate the ViewModel and send to the View when a user requests a page i.e. http://myurl/books/1
I am aware that if I was using something like Angular which is fully client-side I wouldn't be running into this issue.
That's a good question. There's three different approaches that I can think of:
The first is to call the same API from your MVC controller with a HTTPClient object. Might seem a bit weird calling "yourself" on the server side but it works. In my opinion this isn't a great solution, because you're losing type-checking and you'll also making an unnecessary call over the network, and you also have to parse and convert the response back from WebAPI to your .net objects.
The second approach is to move all of the logic that's inside the API into a new project and compile it all down to a DLL. Your Web Api can then call the code inside the library and your MVC project can do it too. A pretty good approach.
The third approach is to do what you've suggested - don't populate the Model at all on the server side inside your MVC project and just do it all from the client side. Yes, this will work great with Angular but you can also do this yourself using bog-standard JQuery or Knockout. This approach means much more client side javascript to write (use Typescript!) but you'll end up with a much nicer separation of concerns and cleaner solution.

Can I use jsOAuth from a ASP Classic page (JScript)?

There's a Javascript library for doing OAuth - called jsOAuth.
The examples that are available show it being used from within browsers. There are also some examples that claim to show how to use it from Node.js.
Can it also be used from ASP Classic / JScript ?
The key test would be:
can jsOAuth be used to post a Tweet on behalf of a user, from an ASP Classic page?
No, I don't think so.
The library has a couple problems that prevent it from being used as is, from an ASP-Classic page implemented in Javascript.
the basic syntax of the library assumes a require package and a well-known exports variable. These conventions aren't present in ASP Classic. Also it directly assigns properties to the global "this" object, which isn't directly possible in ASP Classic.
jsOAuth presumes the presence of the map method on all Array types.
jsOAuth instantiates XMLHttpRequest instances directly from the XMLHttpRequest constructor. This constructor is available in the Javascript execution environment within modern browsers, but it isn't available within ASP-Classic. The library could fall back to use new ActiveXObject("MSXML2.ServerXMLHTTP"), but it does not.
The library presumes asynchronous XMLHttpRequest operation. In a browser, that works just fine. But in ASP-Classic page, the page process ends, which means pending asynchronous calls are orphaned. In the ASP-Classic environment, it would be necessary to make synchronous calls to the OAuth-protected Service Provider.
So out of the box, not possible. The other major obstacle to using it within ASP Classic is the lack of suitable documentation and examples.
It is possible to modify the library to allow it to be used in ASP Classic; I've put together a modified version. I'll post it shortly.

Concerns when using ScriptManager for Custom Non-Ajax Scripts

I have an application that uses various script files. These files are not used for any AJAX purposes. However, I am using MS AJAX Libraries. My goal is to use the ScriptManager to manage release and debug versions of my JavaScript. Is this the right approach? Is there a better way to handle this task?
I found that there is some additional overhead when you are using the ScriptManager. After doing some reading it looks like the ScriptManager control should only be used if you plan on sending down the AJAX library otherwise it would be advised to use the ClientScriptManager.

Is it possible to use Rhino.Commons.HttpModules.UnitOfWorkApplication in ASP.NET 3.5 (not MVC)?

I tried to find tutorials/articles on using UnitOfWorkApplication in ASP.NET (not MVC). But all information I can find is about how to use it in ASP.NET MVC.
Does it mean that it is not possible to use Rhino.Commons.HttpModules.UnitOfWorkApplication in our old webform applications?
I run into the problem that I am using repository inherited from Rhino.Commons.NHRepository in ASP.NET pages. It requires to call UnitOfWork.Start() before calling functions in the repository. I'm quite lost in figuring out how to hook that into ASP.NET.
Yes, it works with regular ASP.NET. Just make your GlobalApplication inherit from UnitOfWorkApplication. UnitOfWork.Start() is automatically executed when the request starts (source code).
For reference, check the wiki page.

What is the difference between Microsoft AJAX and AJAX Pro?

What is the difference between Microsoft AJAx and AJAX Pro?
Also, for what should I use AJAX Pro?
Microsoft AJAX is Microsoft's Ajax library that contains ready to use server controls.
AJAX Pro is a free AJAX library, that enables you to implement your Ajax calls manually. It's a little bit difficult to use then Microsoft's controls. But you have more control on the data and html elements with this library.
With AJAX Pro, you define AjaxMethods, and call them in client-side. with callback methods you get the return value and implement your logic. Whole serializable .NET objects converted successfully to javascript objects.
In Ajax Pro when you make an ajax call, only the method you defined is called. In Microsoft Ajax, whole page life-cycle called instead. Because of this, you can not change properties of controls on page with Ajax Pro. You should do it manually by callback functions in javascript. But in Microsoft AJAX, you have ability to change control's properties in Ajax methods.
My suggestion, if you have knowledge of Javascript and HTML, try Ajax Pro or JQuery for AJAX. But if you're a newbie, begin with Microsoft Ajax.
if you like the way AJAX pro works then i suggest you look at www.coolite.com, they are amazing controls, the people there took EXTJS and did all he pluming work for you and you have great fast controls, where you can also define Ajaxmethods, Webmehtods.
also if you really want to use Microsoft Ajax, then i advise using Teleirk Ajax Controls set, it is built upon Microsoft Ajax framework, but with enormous options and great support, i personally use them everyday.
hope this helps.
I think the developer of Ajax Pro went on to work for Microsoft when they built Atlas.

Resources