C
C#15mo ago
star

❔ Web Request

I have a code like the one in the picture and this code is going well, but the response is not getting the result I want, why?
142 Replies
Thinker
Thinker15mo ago
god, please use HttpClient
star
starOP15mo ago
Netcore 3.0
Nax
Nax15mo ago
Use UTF8 encoding
Thinker
Thinker15mo ago
Yeah HttpClient is available since Framework 4.5
star
starOP15mo ago
why I tried utf 8, it didn't work
Nax
Nax15mo ago
Because it supports a wider range of characters and trying to encode higher encoded characters into ascii is going to cause malformations
star
starOP15mo ago
@🌈 Thinker 🌈 httpclient add header?
Thinker
Thinker15mo ago
wdym?
star
starOP15mo ago
what send code i tried and it didn't work Encoding.UTF8.GetString(responseArray, 0, responseArray.Length)
star
starOP15mo ago
@🌈 Thinker 🌈 @Nax
star
starOP15mo ago
why error await?
Thinker
Thinker15mo ago
What does the error say?
star
starOP15mo ago
@🌈 Thinker 🌈 The 'await' operator can only be used inside an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task<int>'
Thinker
Thinker15mo ago
Yeah, so do what it says
star
starOP15mo ago
? :DDDD
SinFluxx
SinFluxx15mo ago
Consider marking this method with the 'async' modifier and changing its return type to 'Task<int>'
SinFluxx
SinFluxx15mo ago
Asynchronous programming in C#
An overview of the C# language support for asynchronous programming using async, await, Task, and Task
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
@TeBeClone
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
star
starOP15mo ago
upgraded net core 5.1
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
wht
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Huh...?
star
starOP15mo ago
SORRY 5.0
Azrael
Azrael15mo ago
.NET 5?
star
starOP15mo ago
+
Azrael
Azrael15mo ago
Okay.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
^
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
@TeBeClone Why is the result like this?
Azrael
Azrael15mo ago
Use .NET 8 :)
star
starOP15mo ago
.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
no encode
Azrael
Azrael15mo ago
Which decoding are you using?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
$code
MODiX
MODiX15mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
no no send
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Why do people insist on sending screenshots over code snippets?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
:) I do the same.
star
starOP15mo ago
sended @TeBeClone
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
You're still using ASCIIEncoding.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Switch to .NET 7. Switch to HttpClient & UTF-8.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX15mo ago
$mains
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
MODiX
MODiX15mo ago
The possible signatures for Main are
public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }
public static void Main() { }
public static int Main() { }
public static void Main(string[] args) { }
public static int Main(string[] args) { }
public static async Task Main() { }
public static async Task<int> Main() { }
public static async Task Main(string[] args) { }
public static async Task<int> Main(string[] args) { }
public is not required (can be any accessibility). Top-level statements are compiled into a Main method and will use an appropriate signature depending on the body. https://docs.microsoft.com/en-US/dotnet/csharp/fundamentals/program-structure/main-command-line
Main() and command-line arguments
Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
star
starOP15mo ago
httpclient
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
I usually create another main. MainAsync.
star
starOP15mo ago
the result is bad
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
What? HttpClient is much better than WebClient.
star
starOP15mo ago
the result is wrong, there is no problem with other codes
Azrael
Azrael15mo ago
I like HttpFactory. You're doing it wrong.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
HTTP CLIENT ALREADY
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
I'm so confused, is there any chance you could throw it away?
Azrael
Azrael15mo ago
What?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
star
starOP15mo ago
@TeBeClone @Azrael
Azrael
Azrael15mo ago
:(
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
We're here, you don't need to ping us.
star
starOP15mo ago
okey sorryt sorry bro
Azrael
Azrael15mo ago
Once again, you have to post the code snippet. $code
MODiX
MODiX15mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
star
starOP15mo ago
star
starOP15mo ago
I lost my mind.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
... That's GZIP and DEFLATE.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
what
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate");
client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip, deflate");
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
If it's compressed it won't be readable.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
🤷‍♂️
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
Don't get me wrong, I just wrote it to correct why the result was wrong.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
THANKS THANKS THANKS LOVE
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
a little mistake i'm so sorry i took your time thank you yes friend
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Lol.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
@TeBeClone game client
Azrael
Azrael15mo ago
You can't just print out GZIP data and expect a raw string correctly encoded.
star
starOP15mo ago
I'm building a client map or something to upload special models to players. Thanks @Azrael @TeBeClone
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Okay. You're still doing a lot of things incorrectly.
star
starOP15mo ago
why
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
^
star
starOP15mo ago
what
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
He's emulating an interactive session lol.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Yes. Which won't work.
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Most likely not. Automating such a thing violates most TOSs.
star
starOP15mo ago
thanks @Azrael @TeBeClone
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Please...
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
yes account information get
Azrael
Azrael15mo ago
You're also hard coding paths, headers, agents and stuff.
star
starOP15mo ago
@Azrael @TeBeClone 571aee97d861e11cf938092ca612da9ee06d077a what hashe does this look like
Azrael
Azrael15mo ago
... Probably SHA-1?
star
starOP15mo ago
idk session id
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Yes. Doesn't sound "TOS following".
star
starOP15mo ago
okey okye s close
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
na friend doğukan üçkardeş(Hera) real name instagram dogukanückardes add
Azrael
Azrael15mo ago
Why'd you say his name?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
I did not do anything @TeBeClone
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
star
starOP15mo ago
okey oeky sorry bro Did Hera answer?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Azrael
Azrael15mo ago
Reasonable.
star
starOP15mo ago
thanks @TeBeClone delete channel please
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server