hi friends...
i want to call a .cs file from HTML page using javascript/AJAX concept...can anyone send me such samples?? i have only worked in .net framework...but here i m not using .Net framework.
help me guys...........
Thanks in advance.....
Loading

Akkiraju IvaturiRank #473 · 5.3K reputationPosted Jan 20, 2013, 6:21 AM EST
If you are not using Dotnet Framework, then why are you referring to .CS file? By the way what is your purpose of calling .cs file from HTML page? Do you want to execute server side methods from HTML?
sathish kumar115 reputationPosted Jan 20, 2013, 8:29 PM EST
Ved Prakash7 reputationPosted Jan 21, 2013, 3:44 AM EST
You couldn't. A '.cs' is a C# source code file, and cannot be used as-it-is. You must compile it to a DLL.
And once you compile , you can't communicate with a DLL from JavaScript.
JavaScript is sandboxed into your browser.
You'd need to write (and install on every client PC) a browser extension to interface with a native DLL.
You need to rewrite the C# code as JavaScript.
Akkiraju IvaturiRank #473 · 5.3K reputationPosted Jan 21, 2013, 8:19 AM EST
You cannot call .cs file from HTML/AJAX. But what you can do is instead of .CS, create all your methods in ASPX files only and call them from AJAX.
Follow the article http://www.c-sharpcorner.com/UploadFile/akkiraju/calling-server-side-function-from-link-button-using-ajax-and/
In this article all the server side code is added in the .aspx file only. On the UI, I am calling the .aspx file method using AJAX and jQuery. And then binding the response to the UI element (In this article, it is a div tag).
.CS file needs to be compiled and so you cannot consume it directly.
But note that still to work with .ASPX file you need to have .NET framework installed. Otherwise, you cannot implement. If your server is IIS then it is going to support .ASPX, .ASHX and .ASP files by default that means .NET is available.
Let me know what is your exact requirement on the Server. I mean what is your server where you wanted to call the server code from the HTML using AJAX?
Feel free to ask any question relating to this.