C#/ASP Based Reverse AJAX - c#

I have a current project running using APE that needs to work on C#/.NET... I was wondering if anyone had any suggestions for either a method of approaching Reverse AJAX/Comet on C#/.NET or any packages such as APE that are available.
EDIT
For clarification, APE doesn't work on Windows. Which is a restriction I have with the project.

I think that you asking for something like
http://www.frozenmountain.com/websync/
or
http://www.aaronlerch.com/blog/2007/07/08/creating-comet-applications-with-aspnet/
This is called comet technique and is a web application model in which a long-held HTTP request allows a web server to push data to a browser, without the browser explicitly requesting it.

PokeIn comet ajax library works platform independent. ( Mono + .Net )

Related

Angular JS + Cross Domain + Web API

I am planning to use Angular JS + Web API together for my application.
Technologies : VS 2013, .NET 4.0, MS Server 2003.
I have my Web API & Angular JS Client on two different domains [Mandatory]. I tried achieving what i need using .NET 4.5/4.5.1 with CORS in Web API, but because MS Server 2003 does not support installation > .NET 4.0 have to give up the thought. So the solution might not be fully viable for my case.
Can someone suggest how to achieve this with the above mentioned restrictions in mind?
Any help is highly appreciated. Thanks.
One way to do this (to 'avoid' CORS that is) is to implement a solution that has a sever-side component as well as the client-side (angular). AngularJS would call the server-side (same web site, really, but a different path) that would then call the server. Thus, a client is not calling the web API directly, but the server is.
There's security concerns to be aware of, of course, but the general idea still applies: make your API calls from the server instead of client, and have the client call the server.

Is there such a thing as an entirely empty website project?

I'm looking at working my long-standing API to run on IIS rather than in a desktop app as it is now. Everything on the API is working so I'd rather not change too much if I don't have to. I know about the new Web API template in ASP.NET MVC 4 and I've worked with it, but I found that it didn't give me the control over everything that this particular project needs.
So my question is, is there any way to build an application for IIS that has something like an entry-point where I can just get a web request then use entirely my own code from there? Or do I have to build something that uses the Web API?
Yes, you'll want an ASP.NET handler.
How To Create an ASP.NET HTTP Handler by Using Visual C# .NET
http://support.microsoft.com/kb/308001
You'll need to handle parsing the request and serializing the result yourself. It's probably much better to create a web-api facade in front of your services than trying to do it manually.

How do I interact with a silverlight website from C++/C#

i want to interact via code with a silverlight (ver. 4) website.
i need to scrape data from the silverlight object as well as click on buttons.
what would be the simple way to do this from c# ?
what would be the simple way to do this from c++ ?
There is no such thing as a "Silverlight Website". Silverlight is a client-side technology.
Perhaps you could use something like Fiddler to examine the client to server conversation as the silverlight app is used. You might then be able to emulate it in a C++ or C# application.
Otherwise you will need some scriptable UI testing tool perhaps.
I doubt that you can scrape any data from the Silverlight control directly. If you "view source" on the page, that's all you will be able to get by scraping the page the control runs in.
UPDATE:
Anthony makes a good point that you might be able to observe the client/server communication. Fiddler is a good tool to see what's happening in that communication. If you find that the data you need is accessible in that communication, you could modify an http proxy to intercept the traffic and pull out the data you are interested in. You would tell your web browser to go to your http proxy, and the http proxy would then connect to the internet (or your existing proxy if you use one).
There are numerous http proxies available with source code. Here's a very simple one: http://code.cheesydesign.com/?p=393
For what I gather from your very brief description of your problem I'm going to jump to the conclusion that you want to do basically what Sliverlight Spy does. Checkout this blog post describing someone trying to emulate a little of what Spy does:
http://blog.aschommer.de/page/Injecting-code-into-Silverlight-applications.aspx
He's using Fiddler to modify the binaries in the XAP as they are downloaded, but before they're loaded by the SL plug-in. Pretty complicated.
Alternatively, I wonder if there something that could be done with a hosted browser in a C++/C# application, dynamic injection of javascript into the hosted page, and the Javascript API that SL exposes.

Implement restful url in .net where service is implemented using IHTTPHandler

I want to implement a restful service in ASP.NET. I want it to be compatible with .Net 2.0 and IIS 5+. I am constrained to not use ASP.NET MVC or REST starter kit. By reading on internet I have learned that it can be implemented using HTTPHandlers. The problem is, the request will come in as a POST request. And I want to URL to be like:
http://abc.com/MyService/MyMethod1/
and
http://abc.com/MyService/MyMethod2/
Any workarounds for this?
Thanks,
Vamyip
Your best option is to use URL Rewriting. This is non-trivial in IIS5. The methods I know of are as follows:
Method 1 - ISAPI filter
These are low-level modules that allow you to manipulate the incoming request. Programming one of these is hairy and tough to debug. If you go this route, you are better off using one that has already been built like ISAPI_Rewrite.
Method 2 - IHttpModule
These are managed ASP.Net modules that are easy to add/remove from your application. Again, you are better off using a pre-built component like UrlRewriter.NET. The issue with using one of these, (as BrainLy mentions), is that you have to configure IIS 5 to map all incoming requests to ASP.Net as follows (link):
Open Up IIS and Navigate to the “Home Directory Tab”
Select “Configuration”
Click “Add” and enter “C:\WINNT\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll” in the Executable box. For the file extension, enter “.*”. Finally, make sure that “Check that file exists” is not checked.
One interesting thing to note is that ASP.Net is itself an ISAPI module :)
Once you are able to manipulate URLs using one of these tools, you can easily rewrite the RESTful urls to be handled by your default.aspx page (or whatever handler you choose to use).
If you can allow the restriction of only IIS 7.0 and above you could use URL Rewrite http://www.iis.net/download/URLRewrite to do that pretty easily.
Can I ask why is it that you need to support IIS 5+? That is an 11 year old technology that hopefully people will move out of those platforms in favor of more recent versions. Also keep in mind support for some of those platforms is ending pretty soon.
If the concern is developers running Windows XP I would point out that IIS Express includes version 7.5+ functionality and is available for all platforms Windows XP and above.
I think this will be difficult to do because IIS 5 will not let you handle non ASP.NET file extensions without some additional configuration in IIS. That means you are limited to URLs ending in .aspx etc. To handle URLs like those in your examples you need to map ASP.NET to handle all URLs in IIS, implement some type of URL rewriting, or introduce some kind of hacky 404 redirection.
Once you have the correct mapping in place you can wire up an IHttpHandler, but you will have to parse the incoming request yourself to work out which is /MyService/MyMethod1/ and which is for /MyService/MyMethod2/. If your methods are simple then it is easy to do this with a regular expression.
You should start with a simple handler like this one.

best method to refer .Net functions via php

can any one please advice me, is there any possibilities to access .Net modules using php
One thing that i can suggest is
step 1 : create web service in .net which is client script enable
or create one aspx page
setp 2 : call the web service method or web page using jquery ajax or javascript ajax
by this way you can achieve things you want
Ditto pranay. .NET makes it extremely easy to create WSDL-based web services that PHP can easily communicate with. In my experience you should shy away from using DLLs if you can - doing so locks you into running your application on IIS, bit of a nasty surprise and rewrite if you ever need to switch your PHP application to a *nix based server setup.
However, depending on your needs you may not want/need to call it using jQuery. PHP has more than adequate SOAP functionality built into the core.

Categories

Resources