在我的 C# 应用程序中,我得到以下代码:
private void button1_Click(object sender, EventArgs e)
{
string uri = urlTextBox.Text;
Uri myURL;
if (!Uri.TryCreate(uri, UriKind.Absolute, out myURL))
return;
WebRequest request = WebRequest.Create(myURL);
request.Method = "GET";
using (WebResponse response = request.GetResponse())
{
using (Stream stream = response.GetResponseStream())
{
using(StreamReader sr = new StreamReader(stream))
{
responseTextBox.Text = sr.ReadToEnd();
}
}
}
}
但是当我单击按钮时,它会返回以下文本:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Login Timed Out</title>
<link rel=stylesheet type="text/css" href="../../shared/css/ilearn_base.css">
<script>
function redirectToTop(reloginLoc) {
if (opener != null && opener != self) {
opener.top.location = reloginLoc;
window.close();
}
else if (top != self) {
top.location = reloginLoc;
}
else {
location = reloginLoc;
}
}
</script>
<noscript>
Your browser does not support JavaScript. Please turn on JavaScript to use the features of this web page.
</noscript>
</head>
<body onLoad="redirectToTop('../../learner/jsp/relogin_site.jsp')">
</body>
</html>
我不明白为什么它说:“ Your browser does not support JavaScript. Please turn on JavaScript to use the features of this web page.
”,因为我在我当前的浏览器和 IE 中都激活了 JavaScript。
在我的 Internet 浏览器中,页面看起来不同,执行了脚本,我想了解如何在 C# 浏览器中激活 javascript 以获得完整响应。