Help me please

I am writing a simple class library with some http functions, so far I can send a request with user/pass but when I trie to see the response using this code(please dont laugh at it due to the fact that i'm 13 and havent been programing in c# very long)

HttpWebResponse response = (HttpWebResponse)request.GetResponse();

StreamReader sr = new StreamReader(response.GetResponseStream());

result = sr.ReadToEnd();

sr.Close();

FileStream fst = new FileStream("result.txt",FileMode.Create, FileAccess.Write);

StreamWriter fout = new StreamWriter(fst);

fout.Write(result);

it creats a txt file but the file contains a whole lot of *** that I dont uderstand, I wont post all the text(its 40kb) but here is a sample


<!--
*********************************************************
* Copyright 2003, CyberTAN Inc. All Rights Reserved *
*********************************************************

This is UNPUBLISHED PROPRIETARY SOURCE CODE of CyberTAN Inc.
the contents of this file may not be disclosed to third parties,
copied or duplicated in any form without the prior written
permission of CyberTAN Inc.

This software should be used as a reference only, and it not
intended for production use!


THIS SOFTWARE IS OFFERED "AS IS", AND CYBERTAN GRANTS NO WARRANTIES OF ANY
KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. CYBERTAN
SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE
-->

<HTML><HEAD><TITLE>Setup</TITLE>
<meta http-equiv="expires" content="0">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css">
<style fprolloverstyle>
A:hover {color: #00FFFF}
.small A:hover {color: #00FFFF}
</style>
<script src="common.js"></script>
<SCRIPT language=JavaScript>
var EN_DIS2 = '0';
var wan_proto = 'dhcp';
var dhcp_win = null;

function valid_mtu(I)
{
var start = null;
var end = null;
if(wan_proto == "pppoe"){
start = 576;
end = 1492;
}
else if(wan_proto == "pptp"){
start = 1200;
end = 1460;
}
else{
start = 576;
end = 1500;
}

valid_range(I,start,end,"MTU");
}
function SelMTU(num,F)
{
mtu_enable_disable(F,num);
}
function mtu_enable_disable(F,I)
{
EN_DIS1 = I;
if ( I == "0" ){
choose_disable(F.wan_mtu);
}
else{
choose_enable(F.wan_mtu);
}
}


function SelWAN(num,F)
{
F.submit_button.value = "index";
F.change_action.value = "gozila_cgi";
F.wan_proto.value=F.wan_proto.options[num].value;
F.submit();
}

function SelPPP(num,F)
{
F.submit_button.value = "index";
F.change_action.value = "gozila_cgi";
F.mpppoe_enable.value = F.mpppoe_enable.options[num].value;
F.submit();
}

function to_submit(F)
{
if(valid_value(F)){
if(F._daylight_time.checked == false)
F.daylight_time.value = 0;
else
F.daylight_time.value = 1;

F.submit_button.value = "index";
F.action.value = "Apply";
F.submit();
}
}
function valid_value(F)
{
if(F.now_proto.value == "pptp" || F.now_proto.value == "static"){
if(!valid_ip(F,"F.wan_ipaddr","IP",ZERO_NO|MASK_NO))
return false;

if(!valid_mask(F,"F.wan_netmask",ZERO_NO|BCST_NO))
return false;

if(F.now_proto.value == "static"){
if(!valid_ip(F,"F.wan_gateway","Gateway",ZERO_NO|MASK_NO))
return false;
//if(!valid_ip(F,"F.wan_dns0","DNS",MASK_NO))
// return false;
//if(!valid_ip(F,"F.wan_dns1","DNS",MASK_NO))
// return false;
//if(!valid_ip(F,"F.wan_dns2","DNS",MASK_NO))
// return false;
if(!valid_ip_gw(F,"F.wan_ipaddr","F.wan_netmask","F.wan_gatewa

All I want to do is see if i'm loged in or not, someone please help




Answer this question

Help me please

  • Ali Enteshari

    hi,

    this is html page not textfile, so in your filestream use .html extension not .txt

    then you can see the file content properly, because javascript works in IE

    hope this helps



  • Gary B

    thank you, bye the time you posted that i had already renamed the .txt file to a .html file after it was created just to view it in firefox to see if it really was what i thought it was but i forgot to make that change in my code. also i want to veiw it in a gui program i am writing so could i use the web browser control for that

    ps: once again i am 13 so anything i say may sound kind of nOObish



  • James Juno

    thank you, but my funtions are in a class library and i dont want to create a .html file every time i log into something, instead i just want to be able to read the varible so is there a way to pass the vaule of a varible in a dll to a app that is using it

  • Jdjr2

    hi,

    yes you can do that , add a webbrowser control to your form , the webbrowser control has a DocumentText property you can use it like

    WebBrowser1.DocumentText = result ;

    hope this helps



  • Hegbom

    oh wait, this is probably javascript that it wants me to use to make that screen you get when you log into a router or something(did i metion i am testing this on my dads linksys)

    please tell me if i am right, and if i am rigth can you give me some pointers on how to use this javascript because i dont know how to do what i think it whants me to do



  • Help me please