How to reference cordova.js in Visual Studio 2013 webforms project? - asp.net

I am building a web application (using ASP.NET Webforms) that will be used on Android phones (Mobile Chrome). I would like to reference cordova.js in the project to use Camera API.
Could someone please provide me with brief steps on how to build Cordova for Android on Windows 7 machine so that I could reference it in Visual Studio project?
http://cordova.apache.org/docs/en/1.5.0/phonegap_camera_camera.md.html#Camera
Thank you

no! completely wrong idea! well, I had this idea same as you because I'm also an asp.net programmer.
the Api can be used only if the html files are placed inside the Android phone, if you open an aspx file, which is located in the IIS, you lose control of the phone and cannot access the api.
so, what you should do is: For the client side, use html, css, JavaScript to write your program. For the Server side, build an asmx Web Services for the client to call.
then in the client side, use 'ajax', 'Post' call the webservices, with 'Cors' enabled and with 'json' data type.

Related

How to integrate .NET web application project (API) with Apache Cordova Project?

So this is the issue:
I have a .NET project that includes 5 Web Application Layers.
One of them is API.
I Recently added a Cordova project as well and I'd like it to communicate with the API Layer.
Is there anyone who knows what to do?
P.S.:
I use visual studio 2013.
You can use normal jQuery Ajax calls to make requests to the API. http://api.jquery.com/jquery.ajax/ or just normal JavaScript ajax https://stackoverflow.com/a/8567149/487940.
I hope that answers your question.
If you're talking about calling into Web API web services from a Cordova app, you may find the Breeze.JS framework useful to help you. You can either just used the client library or use some server side code in addition to client code to help get you up and running and exposing new web services as well.
Otherwise it is simply a matter of making web service calls to the server from your JavaScript code but the specifics will depend on exactly what you're trying to do and what client UI/utility framework you are using.

Using SocketScan SDK with C# Web Service

What I am trying to do is to call a web service using jquery (ajax json call) and use this SocketScan sdk in the web service (C# based web service).
As, my Mobile App uses only Jquery so I have to make use of this Socketscan sdk in the web service only.
I want to build a sample app for the same. How can I achieve this?
I have added the dll reference to my web service and can see all the methods used in dll but I am not able to understand the flow of dll.
Regards
Aman
Telerik AppBuilder is based on Cordova, so you can't call native code directly and the ScanAPI SDK doesn't support javascript. You will need a plugin which wraps the native SDK (C#, Java or Objective-C, depending on your target platform) and exposes the functionality you need to your app. You may have to develop a Cordova plugin, if there isn't already a plugin released under a suitable license for your app.

Adding a Single Web Service to an Existing ASP.NET Application

I've written an ASP.NET website along with a companion WinForms desktop application, which is used to maintain the site.
The desktop application needs to create a user. However, this is awkward because I would need to ensure all the membership settings are exactly the same as they are in my website's web.config file.
It would be easier if my desktop application could "call into" the website somehow and tell it to create a user. It seems like a web service would be a good option for this. However, Visual Studio doesn't have an option to add an ASMX file. And if I create a separate, web service application, then that application would have the same problem my desktop application has.
Is there a way to add a single web service to an existing ASP.NET application? Any links? Thanks.
Visual Studio doesn't have an option to add an ASMX file
In the Web application project, or the WinForms project? I assume you mean that you cannot add a Web Reference from within your WinForms project; adding an .asmx file to the WinForms project is not necessary. The Web application project should have the .asmx file, which is called by the WinForms project using a web reference.
In the WinForms project you can consume a web service by right-clicking References in the Solution Explorer, then choosing Add Service Reference... (in Visual Studio 2008; other versions may say Add Web Reference...). Then just enter the web address (which may be local in your case, e.g. localhost/foo.asmx) of the web service (.asmx).
See the section "To call an XML Web service synchronously" in this MSDN article: Calling XML Web Services from Windows Forms.
As an alternative, this MS KB article shows how to use the WSDL tool to generate a class that can consume a *.asmx URL. (The article uses VB, but you can switch the parameter to CS to generate C#.)
Update
To add an .asmx file to your Web project, right-click the project in Visual Studio, select Add -> New Item... -> Web Service. If there is not a "Web Service" item any where in the template browser dialog that comes up, then you are missing the template or you're looking in the wrong place.

Running application from browser ASP.NET

I have a c# windows application that can successfully record audio using user's desktop mic.
Now i want this facility to run from ASP.NET website. (Note: user would not have this application installed on his machine).
Is there a way that i can run this application from a web page and record and save sound file on user's desktop? I searched on google and found that it is achievable using ActiveX. But i am not sure how to do this.... :((
Any Clue...??
Thanks...
You are not going to be able to do this using standard HTML / web browser functionality.
You will need to use a richer, client-side platform like Silverlight or Flash. ActiveX could also support this, but it's a pretty dated technology. Better to go with Silverlight or Flash.

.NET and webservices: how?

Im trying to make a webservice in ASP.NET and get the data in a Smart Device Application.
I have the standard HelloWorld webservice and i wanna get the data in my application, but when i try to add a web reference to my project, Visual Studio can't find any webservices running. If i start the WebService in the WebService project and copy/paste the url to the "Add WebReference" in the Application project, Visual Studio finds the Webservice and i can use the InttilSence to find the HelloWorld Method (WebServiceClass.HelloWorld()) in the WebService. But when i then run the Application project the complier gives an error saying that it can't connect to the WebService.
How do i do this? How do i access a webservice in an Application project? Every tutorial or book i have read about the subject doesn't tell anything about how the webservice should i run. In my world the webservice project should be running before i can access it from another project or am i wrong?
Consider reading Rick Strahl's Creating Web Services with .NET and Visual Studio.
From there, you'll get the basics. You can build and deploy your XML SOAP web service.
Then you'll need to have your application use that web service as a 'Web Reference'. Start by "Add Web Reference".
(source: usaepay.com)
First, you should publish the web service to some server (even your own local IIS) rather than using the Visual Studio web server.
Then in your application, point to the correct URL wherever you published it when adding the reference.
While this is a bit low-tech, couldn't you create a web requrest from the Smart Device Application to hit the webservice directly? That would be my suggestion.
An example would be using the "WebRequest" Class.
It sounds like when you try to access the Web Service from your app, the service is not running (possibly because you're only running it in the Cassini server?).
The fact that you were able to generate the Web Reference means that at some point, the service was running and was able to generate the helper classes by examining the service.
I would do as David Stratton suggests and publish it somewhere where it can run while you are developing the Smart Device app (like your local IIS).
You might also take the opportunity to wrap the service call with some error handling - maybe catch the specific exception being thrown (System.Net.WebException?)

Resources