Hack Forums
[C#] PLEASE help me fix this exception error - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [C#] PLEASE help me fix this exception error (/showthread.php?tid=6096700)



PLEASE help me fix this exception error - Nyx - Jul 21, 2020

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)



RE: PLEASE help me fix this exception _error_ - gigajew - Jul 21, 2020

It failed to connect to remote destination. Double check your url.


RE: PLEASE help me fix this exception _error_ - iolaka - Jul 22, 2020

Looks like the host is blocking your connection, use proxies.


RE: PLEASE help me fix this exception _error_ - Nyx - Jul 22, 2020

(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


RE: PLEASE help me fix this exception _error_ - iolaka - Jul 22, 2020

(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?


RE: PLEASE help me fix this exception _error_ - gigajew - Jul 22, 2020

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