开发者

Silverlight Application for the web - storing data on site

I've made a little game as an application for the web in silverlight using C#, and I simply would like to save the top ten scores of any of the users that go on it.

How can I write to a file and save it on my web hosting area? Is this possible?

I think this would be the best way, because I only need to store a name and score (csv file), and this would be extremely easy. I hope this is possible.

If not could someone point me in the rite direction of being able to do this with a database, I've created a template just incase using MySQL with the features provided fro开发者_运维技巧m my web hosts. Is there any easy way to do it that way?

Thanks in advance,

Lloyd


You can add a small WCF service to your website with an ISaveScores interface. The SL app can connect to the WCF service to post scores, and the WCF service can then store the data however you want. If you use a csv file, make sure you handle locking properly, since it is very possible for multiple requests to happen simultaneously.

EDIT Since the host is Linux, just create yourself a rest service or some other service that silverlight can post to in the same way. Silverlight can talk to pretty much any type of service, so use the same technique in your environment.


You could do it with a service as Brian suggested (although it sounds like you might not have windows hosting, so you may not be able to use WCF for it) which is probably the best way -- but if you wanted a simpler solution you could also do it with just a postback to a particular page setup for the purpose.

Write a quickee PHP page that looks for a name and score in POST data, and writes it to your MYSQL database. Call it from your SL app with a webrequest. Then you just need another simple page to query the DB and list the results.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜