Home > Net >  HttpWebRequest simulation after the success of the login, always can't request data, suggest 30
HttpWebRequest simulation after the success of the login, always can't request data, suggest 30

Time:09-19

Each great spirit:

I request to log in using HttpWebRequest simulation, return to the login is successful, then go to the requested page data, always return a 301 error, prompt the user has expired, with caught tools also saw, cookies, token is correct, I don't know where is wrong? Is not sure cookie is out of date, or cross domain redirection,
I use the
Request. CookieContainer=CookieContainer; Save the login cookie;
And use the
String strLocation.=the response Headers (" Location ");
Returns the request data redirection address, found the strLocation is empty,
Please help to instruct me, have a week, haven't done,

CodePudding user response:

301 can't say it's wrong, it is redirected (version Permanently, is changed to another address on web pages), you only have to visit the new address is ok,
Let the HttpWebRequest automatic transfer, can set the HttpWebRequest. AllowAutoRedirect,

CodePudding user response:

reference 1st floor github_36000833 response:
301 can't say it's wrong, it is the redirection (version Permanently, is changed to another address on web pages), you just visit the new address,
Let the HttpWebRequest automatic transfer, can set the HttpWebRequest AllowAutoRedirect,


Automatic transfer to which address? . The response Headers (" Location "); The information is empty,
Always prompt 301, your account has expired,
  •  Tags:  
  • C#
  • Related