Skip to content

C# .NET Server Client Connection without database

john shijith

Asked Apr 4, 2019, 5:05 AM EDT1 answer
Share
LinkedInX
Hi I planned to use JSON in my server to save User Database. for Small number. I planned to save JSOn files in my Server. and use .NetworkComms to retrieve values from JSON in my Client machine. Is that possible and tell me the best way to do it. and also give me some sample coide to do that so... Please...

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Ajay Gupta
    0
    Yes,I think it is possible.
     
    Please try below example code.
    1. function readJSON(path) {  
    2. var xhr = new XMLHttpRequest();  
    3. xhr.open('GET', path, true);  
    4. xhr.responseType = 'blob';  
    5. xhr.onload = function(e) {  
    6. if (this.status == 200) {  
    7. var file = new File([this.response], 'temp');  
    8. var fileReader = new FileReader();  
    9. fileReader.addEventListener('load', function(){  
    10. //do stuff with fileReader.result  
    11. });  
    12. fileReader.readAsText(file);  
    13. }  
    14. }  
    15. xhr.send();  
    16. }  
    or
    1. $.getJSON("sample.json", function (data) {  
    2. $.each(data, function (index, value) {  
    3. console.log(value);  
    4. });  
    5. });  
    0