In my C# app i got the following code:
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();
}
}
}
}
But when I click the button it returns me the following text:
<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>
What I can’t understand is why it says: “Your browser does not support JavaScript. Please turn on JavaScript to use the features of this web page.“, because I activated JavaScript in both my current browser and in IE.
In my Internet Browsers the page looks different, having the scripts executed, and I want to find out how can I activate javascript in C# browser to get the full response.
You are getting the full response.
The noscript tags are included in case your browser doesn’t support javascript. For this page the server likely always includes this in the response – it does not necessarily mean that your browser doesn’t support javascript.