Reading the text from a text file on a web server [duplicate]












0
















This question already has an answer here:




  • Make Https call using HttpClient

    10 answers




I used to be able to read a text file located on our public web server, into a string variable. Something has changed on the web server and now my function does not work anymore. The text file is still there and can be opened using a web browser but I cannot read it from my VB.net application



Here is the link to a sample text file: https://www.mgfx.co.za/license.txt



        Dim http As New Net.Http.HttpClient        
Dim strWebString As String = Await http.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt"))


This does not work anymore and throws an error about authentication. "IOException: Authentication failed because the remote party has closed the transport stream."



I can only imagine that our hosting provider has implemented some sort of new security measures which now block calls from my app.



Can anyone help here or know why this is the case?










share|improve this question













marked as duplicate by Ahmed Abdelhameed, Community Nov 27 '18 at 20:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    May want to check that you're using TLS 1.2, not the default 1.1...a lot of web servers are requiring that now and I've been dealing with programs erroring because of that all year

    – soohoonigan
    Nov 27 '18 at 19:58











  • Just add this line before sending the request for the first time: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls.

    – Ahmed Abdelhameed
    Nov 27 '18 at 20:00













  • It's really strange but the code works for me pretty well: Using client As New HttpClient : Dim x = Await client.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt")) : End Using

    – JohnyL
    Nov 27 '18 at 20:16











  • Thanks guys! The TLS 1.2 setting seems to have solved it.

    – Raider_007
    Nov 27 '18 at 20:27











  • @JohnyL Maybe, you have something like this: <appSettings><add key="SecurityProtocol" value="3072" /></appSettings> or this: <add key="SecurityProtocol" value="Tls12" /> in your app.config file. There's also a registry value that can set this protocol as the default. Some applications, it happens, do this behind your back. Some developers think it's all OK, then they deploy and...

    – Jimi
    Nov 27 '18 at 20:50


















0
















This question already has an answer here:




  • Make Https call using HttpClient

    10 answers




I used to be able to read a text file located on our public web server, into a string variable. Something has changed on the web server and now my function does not work anymore. The text file is still there and can be opened using a web browser but I cannot read it from my VB.net application



Here is the link to a sample text file: https://www.mgfx.co.za/license.txt



        Dim http As New Net.Http.HttpClient        
Dim strWebString As String = Await http.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt"))


This does not work anymore and throws an error about authentication. "IOException: Authentication failed because the remote party has closed the transport stream."



I can only imagine that our hosting provider has implemented some sort of new security measures which now block calls from my app.



Can anyone help here or know why this is the case?










share|improve this question













marked as duplicate by Ahmed Abdelhameed, Community Nov 27 '18 at 20:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    May want to check that you're using TLS 1.2, not the default 1.1...a lot of web servers are requiring that now and I've been dealing with programs erroring because of that all year

    – soohoonigan
    Nov 27 '18 at 19:58











  • Just add this line before sending the request for the first time: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls.

    – Ahmed Abdelhameed
    Nov 27 '18 at 20:00













  • It's really strange but the code works for me pretty well: Using client As New HttpClient : Dim x = Await client.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt")) : End Using

    – JohnyL
    Nov 27 '18 at 20:16











  • Thanks guys! The TLS 1.2 setting seems to have solved it.

    – Raider_007
    Nov 27 '18 at 20:27











  • @JohnyL Maybe, you have something like this: <appSettings><add key="SecurityProtocol" value="3072" /></appSettings> or this: <add key="SecurityProtocol" value="Tls12" /> in your app.config file. There's also a registry value that can set this protocol as the default. Some applications, it happens, do this behind your back. Some developers think it's all OK, then they deploy and...

    – Jimi
    Nov 27 '18 at 20:50
















0












0








0









This question already has an answer here:




  • Make Https call using HttpClient

    10 answers




I used to be able to read a text file located on our public web server, into a string variable. Something has changed on the web server and now my function does not work anymore. The text file is still there and can be opened using a web browser but I cannot read it from my VB.net application



Here is the link to a sample text file: https://www.mgfx.co.za/license.txt



        Dim http As New Net.Http.HttpClient        
Dim strWebString As String = Await http.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt"))


This does not work anymore and throws an error about authentication. "IOException: Authentication failed because the remote party has closed the transport stream."



I can only imagine that our hosting provider has implemented some sort of new security measures which now block calls from my app.



Can anyone help here or know why this is the case?










share|improve this question















This question already has an answer here:




  • Make Https call using HttpClient

    10 answers




I used to be able to read a text file located on our public web server, into a string variable. Something has changed on the web server and now my function does not work anymore. The text file is still there and can be opened using a web browser but I cannot read it from my VB.net application



Here is the link to a sample text file: https://www.mgfx.co.za/license.txt



        Dim http As New Net.Http.HttpClient        
Dim strWebString As String = Await http.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt"))


This does not work anymore and throws an error about authentication. "IOException: Authentication failed because the remote party has closed the transport stream."



I can only imagine that our hosting provider has implemented some sort of new security measures which now block calls from my app.



Can anyone help here or know why this is the case?





This question already has an answer here:




  • Make Https call using HttpClient

    10 answers








vb.net






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 27 '18 at 19:50









Raider_007Raider_007

92




92




marked as duplicate by Ahmed Abdelhameed, Community Nov 27 '18 at 20:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by Ahmed Abdelhameed, Community Nov 27 '18 at 20:36


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    May want to check that you're using TLS 1.2, not the default 1.1...a lot of web servers are requiring that now and I've been dealing with programs erroring because of that all year

    – soohoonigan
    Nov 27 '18 at 19:58











  • Just add this line before sending the request for the first time: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls.

    – Ahmed Abdelhameed
    Nov 27 '18 at 20:00













  • It's really strange but the code works for me pretty well: Using client As New HttpClient : Dim x = Await client.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt")) : End Using

    – JohnyL
    Nov 27 '18 at 20:16











  • Thanks guys! The TLS 1.2 setting seems to have solved it.

    – Raider_007
    Nov 27 '18 at 20:27











  • @JohnyL Maybe, you have something like this: <appSettings><add key="SecurityProtocol" value="3072" /></appSettings> or this: <add key="SecurityProtocol" value="Tls12" /> in your app.config file. There's also a registry value that can set this protocol as the default. Some applications, it happens, do this behind your back. Some developers think it's all OK, then they deploy and...

    – Jimi
    Nov 27 '18 at 20:50
















  • 1





    May want to check that you're using TLS 1.2, not the default 1.1...a lot of web servers are requiring that now and I've been dealing with programs erroring because of that all year

    – soohoonigan
    Nov 27 '18 at 19:58











  • Just add this line before sending the request for the first time: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls.

    – Ahmed Abdelhameed
    Nov 27 '18 at 20:00













  • It's really strange but the code works for me pretty well: Using client As New HttpClient : Dim x = Await client.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt")) : End Using

    – JohnyL
    Nov 27 '18 at 20:16











  • Thanks guys! The TLS 1.2 setting seems to have solved it.

    – Raider_007
    Nov 27 '18 at 20:27











  • @JohnyL Maybe, you have something like this: <appSettings><add key="SecurityProtocol" value="3072" /></appSettings> or this: <add key="SecurityProtocol" value="Tls12" /> in your app.config file. There's also a registry value that can set this protocol as the default. Some applications, it happens, do this behind your back. Some developers think it's all OK, then they deploy and...

    – Jimi
    Nov 27 '18 at 20:50










1




1





May want to check that you're using TLS 1.2, not the default 1.1...a lot of web servers are requiring that now and I've been dealing with programs erroring because of that all year

– soohoonigan
Nov 27 '18 at 19:58





May want to check that you're using TLS 1.2, not the default 1.1...a lot of web servers are requiring that now and I've been dealing with programs erroring because of that all year

– soohoonigan
Nov 27 '18 at 19:58













Just add this line before sending the request for the first time: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls.

– Ahmed Abdelhameed
Nov 27 '18 at 20:00







Just add this line before sending the request for the first time: ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls.

– Ahmed Abdelhameed
Nov 27 '18 at 20:00















It's really strange but the code works for me pretty well: Using client As New HttpClient : Dim x = Await client.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt")) : End Using

– JohnyL
Nov 27 '18 at 20:16





It's really strange but the code works for me pretty well: Using client As New HttpClient : Dim x = Await client.GetStringAsync(New Uri("https://www.mgfx.co.za/license.txt")) : End Using

– JohnyL
Nov 27 '18 at 20:16













Thanks guys! The TLS 1.2 setting seems to have solved it.

– Raider_007
Nov 27 '18 at 20:27





Thanks guys! The TLS 1.2 setting seems to have solved it.

– Raider_007
Nov 27 '18 at 20:27













@JohnyL Maybe, you have something like this: <appSettings><add key="SecurityProtocol" value="3072" /></appSettings> or this: <add key="SecurityProtocol" value="Tls12" /> in your app.config file. There's also a registry value that can set this protocol as the default. Some applications, it happens, do this behind your back. Some developers think it's all OK, then they deploy and...

– Jimi
Nov 27 '18 at 20:50







@JohnyL Maybe, you have something like this: <appSettings><add key="SecurityProtocol" value="3072" /></appSettings> or this: <add key="SecurityProtocol" value="Tls12" /> in your app.config file. There's also a registry value that can set this protocol as the default. Some applications, it happens, do this behind your back. Some developers think it's all OK, then they deploy and...

– Jimi
Nov 27 '18 at 20:50














1 Answer
1






active

oldest

votes


















0














Adding this to my code fixed the issue.



ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls





share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Adding this to my code fixed the issue.



    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls





    share|improve this answer




























      0














      Adding this to my code fixed the issue.



      ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls





      share|improve this answer


























        0












        0








        0







        Adding this to my code fixed the issue.



        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls





        share|improve this answer













        Adding this to my code fixed the issue.



        ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 Or SecurityProtocolType.Tls11 Or SecurityProtocolType.Tls






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 27 '18 at 20:34









        Raider_007Raider_007

        92




        92

















            Popular posts from this blog

            Contact image not getting when fetch all contact list from iPhone by CNContact

            count number of partitions of a set with n elements into k subsets

            A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks