I want my c# program to send an ID string that it gets from the computer where it's running to my web site and I want the web site to respond with a string that it generates by performing an algorithm on the original ID string. I'm brand new to web site development so go easy on me. My web site is in ASP.net C#.
I apologize if this is the wrong place for this question or if it's been answered somewhere else, but I'm not sure where to go and can't find the answer anywhere else.
Thanks
Loading
naura paxPosted Jan 15, 2010, 2:33 AM
To run c# code in database you'd need to have CLR integration in sql server (2005 & later versions). basically you will to create a type library (.dll) of your algorithm in c# then register it in sql server, once registered it can be accessed as a function call, but for that search for CLR integration in BOL.
Web Service is a simple project that you create just like web application from vs 2005,2008,2010 you can find it in new project option,you'd need to look for publishing a web service & discovering (on client application side) which can be done by adding url of your web site while adding web reference in your client application. Once reference is added you'd just have to create an object of the class in web service.
take a look at this http://articles.sitepoint.com/article/net-web-services-5-steps#
good luck!
Todd NicholsPosted Jan 15, 2010, 2:25 AM
I like the database access idea, but I need to run a C# script when I get the data. If you can do that with just the database interaction, then that's beyond my experience. Please respond if this is possible and I'll do more studying.
I will also look into the remoting.
For now, I'll go with the solution I found as I posted above and look into the others so I understand what the best option really is.
Thanks
naura paxPosted Jan 15, 2010, 2:12 AM
There are serveral ways of doing this:
1. Directly access your database server (If it has same live IP address as your website) from your c# client application using connection string. You can encrypt string and return as query result considering the criteria for performing algorithm has been stored persistently in the database.
2. Create a web service and publish it into your web server, you can access it in other applications (This can be very straight forward).
4. Use remoting for interapplication communication.
You'd need to take a look at these technologies in Books Online (msdn) and choose the one that's best for you.
Todd NicholsPosted Jan 15, 2010, 12:51 AM
The program is an application that I have written that will be downloaded by my customers.
I don't think it needs to be encrypted - it's just a string made up of jumbled cpu ID and HDD ID numbers then returning a validation code that wouldn't be useful to anyone except the user of the machine requesting it.
It sounds like you have an idea where I'm going - hope this information gets me closer.
Thanks
OK - since I wrote the above, I've managed to solve my problem.
I copied verbatim How to: Send Data Using the WebRequest Class from msdn for the client side, which actually sends, then receives.
Then I put this on the server in the page load of a new page:
string code = Request.BinaryRead(10).ToString();
Response.Write("Here is the answer");
I can put the code I need between those 2 lines and it will work. When I get the data back at the client I have a bunch of HTML after the answer, but I guess I can make my answer a fixed number of digits and then just take that number of characters off the front.
naura paxPosted Jan 15, 2010, 12:44 AM
I have several questions: Where is your target machine?
Is it going to be on a specific place within a network or web?
Or is it any machine from which your website is going to be accessed?
Is the c# program a standalone (destop client/console/windowservice) application?
Do you want this exchange of string to be encrypted?
hope i'm getting close on that.