Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C# 

PLEASE help me fix this exception error

I am struggling to make this C# program to check for name availability and to claim it in case it is.

This is the function it checks if a given name is available:

Code
public static Tuple<NameStatus> GetSummonerNameChangeAvailable(HttpRequest Client, TurboRequest account)
{
Tuple<NameStatus> result;
try
{
Console.WriteLine("Getavailable");
Client.UserAgent = "RiotClient/18.0.0 (lol-store)";
Client.AddHeader("Accept", "application/json");
                               // The following line throws an error
string Response = Client.Get("https://store." + account.ModifiedRegion + ".lol.riotgames.com/storefront/v3/summonerNameChange/verify/" + account.RequestedAlias, null).ToString();
Console.WriteLine(Response);
bool flag = Response.Contains("nameIsAvailableOnServer");
if (flag)
{
bool flag2 = Response.Contains("\"nameIsAvailableOnServer\":false");
if (flag2)
{
result = new Tuple<NameStatus>(NameStatus.NotAvailable);
}
else
{
bool flag3 = Response.Contains("\"nameIsAvailableOnServer\":true");
if (flag3)
{
result = new Tuple<NameStatus>(NameStatus.Available);
}
else
{
result = new Tuple<NameStatus>(NameStatus.Error);
}
}
}
else
{
result = new Tuple<NameStatus>(NameStatus.Error);
}
}
catch(Exception e)
{
Console.WriteLine("Exception was {0}", e);
result = new Tuple<NameStatus>(NameStatus.Error);
}
return result;
}


I'm having trouble with the line:

Code
string Response = Client.Get("https://store." + account.ModifiedRegion + ".lol.riotgames.com/storefront/v3/summonerNameChange/verify/" + account.RequestedAlias, null).ToString();

The exception it throws is:

Code
Exception thrown: 'Leaf.xNet.HttpException' in Leaf.xNet.dll
Exception was Leaf.xNet.HttpException: It turned out wait for a connection to the HTTP-server 'store.na1.lol.riotgames.com'.
at Leaf.xNet.HttpRequest.CreateTcpConnection(String host, Int32 port)
at Leaf.xNet.HttpRequest.CreateConnection(Uri address)
at Leaf.xNet.HttpRequest.TryCreateConnectionOrUseExisting(Uri address, Uri previousAddress)
at Leaf.xNet.HttpRequest.Request(HttpMethod method, Uri address, HttpContent content)
at Leaf.xNet.HttpRequest.Raw(HttpMethod method, Uri address, HttpContent content)
at Leaf.xNet.HttpRequest.Raw(HttpMethod method, String address, HttpContent content)
at Leaf.xNet.HttpRequest.Get(String address, RequestParams urlParams)
at LeagueTurbo.Core.Instagram.GetSummonerNameChangeAvailable(HttpRequest Client, TurboRequest account)
It failed to connect to remote destination. Double check your url.
[Image: Syr3DlV.png]
Looks like the host is blocking your connection, use proxies.
(Jul 22, 2020 02:35 AM)iolaka Wrote:  Looks like the host is blocking your connection, use proxies.

I've had multiple people try it.
Both the Get and Post requests I have sent return the same exception
(Jul 22, 2020 02:41 AM)Nyx Wrote:  I've had multiple people try it.
Both the Get and Post requests I have sent return the same exception

Could be a security feature in which you are missing a certain header that is not being validated, thus rejecting the connection.
Have you ensured that all headers are correct?
Have you ever made a successful connection to that URL before?
The closest I've got it a GET request to this url, which still returns an error but it's not a "not found" error.
Code
https://store.euw1.lol.riotgames.com/storefront/v3/summonerNameChange/verify/somename
[Image: Syr3DlV.png]


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C] by LunarManureDec 10, 2020 05:21 PM 13 544 Dec 10, 2020 05:21 PM
Last Post: LunarManure
[C#] by KUi29929Aug 11, 2020 12:09 PM 1 296 Aug 11, 2020 12:09 PM
Last Post: VisualSoft
[C#] by KαѕρerJun 14, 2020 04:09 PM 3 145 Jun 14, 2020 04:09 PM
Last Post: kray