我正在尝试使用c#登录我学校的网站。使用Fiddler软件,我设法捕获了浏览器发出的帖子请求以及在c#中重新创建的帖子请求。它们似乎完全相同,但是我得到的响应却不同。如果发布请求相同,至少在相同的状态码下,服务器理论上是否应该以相同的方式响应? 当我使用自己的客户端时,我得到的响应码是200,但是在浏览器中却得到了303(应该是)。
我注意到的是,WebForm内容在浏览器中要大得多,但是客户端请求中使用的值来自先前的GET请求。抱歉,很长的帖子。
这些是Fiddler捕获的请求:
浏览器请求:
POST https://www.lectio.dk/lectio/31/login.aspx HTTP / 1.1
主持人:www.lectio.dk 连接:保持活动状态
内容长度:881
缓存控制:max-age = 0
不安全升级请求:1
Content-Type:应用程序/ x-www-form-urlencoded
用户代理:Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 75.0.3770.100 Safari / 537.36
接受:text / html,application / xhtml + xml,application / xml; q = 0.9,image / webp,image / apng, / ; q = 0.8,application / signed-exchange; v = b3
引荐来源:https://www.lectio.dk/lectio/31/login.aspx
接受编码:gzip,deflate,br
接受语言:en-GB,en-AS; q = 0.9,en-DK; q = 0.8,en; q = 0.7,da-DK; q = 0.6,da; q = 0.5,en-US ; q = 0.4
Cookie:LastLoginExamno = 31; ASP.NET_SessionId = ANTOMFZ7ZZWAYYW52OSZQYRXIBAIEGIPGILQHQ6TEJ2O5XEUTE3CAIBA; isloggedin3 = N
时间= 0&__ EVENTTARGET = M%24Content%24submitbtn2&__ EVENTARGUMENT =&__的scrollPosition =&__ VIEWSTATEX = vQAAAGlpZQk1NDg4MjIyMjVpbAJrAIFsAmhpZGwCZwJpbAJrAWUDb2ZmbASBaWRsAoFpZGwCgWlkbAJoaWpkam4BZQcyMDE5LzIwbgFlBDIwMTl%2BAXFsAWhkZwNpZGwCZwVpZGwCaGlkbAJnB2lkbAaBaWwCawJlFE4mIzIzMDtydW0gR3ltbmFzaXVtZGcFaWRsAoFpZGwCgWlsAmsDZQI1MGRnB2lkbAKBaWRsAoFpamlsAmsEcGRkZGRkBQAAABNWYWxpZGF0ZVJlcXVlc3RNb2RlDGF1dG9jb21wbGV0ZQlpbm5lcmh0bWwJbWF4bGVuZ3RoB0NoZWNrZWQAXXvzIZezMAoPCqv5j%2FZuNIu6H1E%3D&__ VIEWSTATEY_KEY =&__ VIEWSTATE =&__ EVENTVALIDATION = CY6WRLYHybmNGyj0%2FWgw9s%2BaewM2gnWAIUbvnFzgoYWgYPLkQnxHIBIpQPjEa3On7opgtRStMA%2FpLhG9PzzgXNTaWwTZIeSfKwS74n4yMULKRovRw2H%2Fwlg8HRUdJemRR%2FyFEzIkbToD8psr4CO9G3nzX706D25SYrmTc2WygXZ%2B1oYTAMe3FD7ocBdwh%2FrHRBAOaoTzCsCSlpMVce8GxcWKS3lryh8E8yVmy4AgrHpjgj3R0g1ziPKG96%2B1vVr%2B&M%24Content %24username2 =用户名&m%24Content%24passwordHidden = password&LectioPostbackId =
C#客户请求:
POST https://www.lectio.dk/lectio/31/login.aspx HTTP / 1.1
缓存控制:max-age = 0
接受:text / html,application / xhtml + xml,application / xml; q = 0.9,图片/ webp,图片/ apng, / ; q = 0.8,应用程序/签名交换; v = b3
接受编码:gzip,deflate,br
接受语言:en-GB,en-AS; q = 0.9,en-DK; q = 0.8,en; q = 0.7,da-DK; q = 0.6,da; q = 0.5,en-US; q = 0.4
用户代理:Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 75.0.3770.100 Safari / 537.36
引荐来源:https://www.lectio.dk/lectio/31/login.aspx
不安全升级请求:1
连接:保持活动状态
Cookie:LastLoginExamno = 31; ASP.NET_SessionId = DBYVNKXMKMO2F7XF7T22TM4RALBLKYPBQT42BGZX6H2UA5TZ2ZHCAIBA
Content-Type:应用程序/ x-www-form-urlencoded
内容长度:485
主持人:www.lectio.dk
时间= 0&__ EVENTTARGET = M%24Content%24submitbtn2&__ EVENTARGUMENT =&__的scrollPosition =&__ VIEWSTATEX = FAAAAGlpZQotMTY2NzgzMzI1ZGQAAAAAALJLI4R47o%2FDmiaj2f9RNeeWl%2B5K&__ VIEWSTATEY_KEY =&__ VIEWSTATE =&__ EVENTVALIDATION =%2FYOJVoNfWl%2F8olHfFefQyPMhqxIUan914QzoN6cFD0eGMukIp%2B%2FciKjpJU04AgXJhME7LttuUGcP8yOJ7xPSSP%2Bl8AnZk2DAdvMIFLFAAPD2Rf4K1DapTvDcnWnyz%2Bj1tesSoSUmLcmmh2E0ljSNR1Qr%2BUpIWQ91RtL1jS4GDh0%3D&M%24Content%24username2 = povl0057&M% 24Content%24passwordHidden = jdf59jcx&LectioPostbackId =
答案 0 :(得分:1)
如果发布请求相同,服务器理论上应该不会以同样的方式响应吗?
否