2

I have made a C# application , now I want to create custom survey (actually sending data automatically to me, about - crashes , usage duration etc.) to enhance my application .

How can I do it ?

Maifee Ul Asad
  • 3,992
  • 6
  • 38
  • 86
  • We are not here to write your code for you. Also there is way too little information – BotMaster3000 Jan 18 '19 at 13:50
  • My apologies at first , for not providing proper information . Actually I didn't asked for code . Let's assume I have an app , text editor , which has auto-complete enabled . Now how many times user uses that feature I have saved in a local file , xml , database or so and so . Actually what I want is I want to upload those data to my server(own) periodically . How can I do it . I have no idea . Can you help now ? Thanks in advance . – Maifee Ul Asad Jan 18 '19 at 14:02

2 Answers2

2

You may do this:

  1. Host a REST service at your server, the common way is to add a WebAPI controller in ASP.NET MVC project.
  2. On the client application create a System.Threading.Timer instance and set desired schedule to send the statistics. Or just send them each time user starts your application.
  3. Send statistics to your REST service using WebClient/HttpClient.

Tutorials:

Get Started with ASP.NET Web API 2 (C#)

Call a Web API From a .NET Client (C#)

opewix
  • 4,993
  • 1
  • 20
  • 42
1

Sorry for the rough reception you received with that one comment. Many of us understood you weren't asking for us to write code for you, and I think you had a legit question.

You might want to also look at the .Net Trace capabilities. While you won't get data sent to you automatically, there's a built-in, easy-to-use framework that's unobtrusive and let's you gather statistics. Here are some links to check out:

The Trace Class

How to Add Trace Statements to Code

See also

Trace Listeners

So there you go. Another possible way to approach this.

markaaronky
  • 1,231
  • 12
  • 29
  • 1
    Thanks a lot . I had no idea about this "Trace class" , still I have no idea about it . I am studying . As my study will be done , I will let you know . In between if any problem arises maybe I will bother you again , unless I find a stackoverflow thread .Thanks . – Maifee Ul Asad Jan 19 '19 at 03:39
  • 1
    No worries Maifee. Another approach you might want to investigate is using MSMQ in C#. It's a relatively easy to use send/receive message queuing system with tons of easy to understand C# examples available. Any approach you take, you'll have some homework and coding to do, that's the intent I saw in your question. You asked for starting points. However you approach this, with opwix's excellent answer or the ideas I'm throwing out, you're looking at a framework where you build a listener and then the capability to easily send messages to it from your app. Many possibilities. Good luck. – markaaronky Jan 22 '19 at 14:25