Click here to Skip to main content
15,886,110 members
Home / Discussions / C#
   

C#

 
QuestionCatching Line-out signal in C# Pin
Maquis.12-Jan-09 22:08
Maquis.12-Jan-09 22:08 
QuestionInstaller components in C# Pin
adi.rusu12-Jan-09 21:59
adi.rusu12-Jan-09 21:59 
AnswerRe: Installer components in C# Pin
rohan_puranik12-Jan-09 23:25
rohan_puranik12-Jan-09 23:25 
GeneralRe: Installer components in C# Pin
adi.rusu13-Jan-09 0:29
adi.rusu13-Jan-09 0:29 
QuestionHow to rotate a form in c#, or maybe just the controlls? Pin
maclinux12-Jan-09 21:09
maclinux12-Jan-09 21:09 
AnswerRe: How to rotate a form in c#, or maybe just the controlls? Pin
benjymous12-Jan-09 21:35
benjymous12-Jan-09 21:35 
AnswerRe: How to rotate a form in c#, or maybe just the controlls? Pin
musefan12-Jan-09 21:58
musefan12-Jan-09 21:58 
QuestionLog Into Website using WebRequest Pin
AksharRoop12-Jan-09 21:07
AksharRoop12-Jan-09 21:07 
Hi Guys,

I am writing an application that logs to a website and read its contents. Log in page of a web i am trying to connect is as follow:

<br />
<html><br />
<head><br />
  <script type="text/javascript"><br />
        document.cookie="ttAuthInfo=; expires=Sat, 03-Jan-70 00:00:01 GMT";<br />
        document.cookie="ttloggedoff=t";<br />
function doSubmit()<br />
{<br />
  document.cookie='ttloggedoff=f';<br />
  try<br />
  {<br />
    if (window.parent&&window.parent.opener&&window.parent.opener.document&&window.parent.opener.document.LoginForm&&window.parent.opener.document.LoginForm.ttAuthUID)<br />
    {<br />
      window.parent.opener.document.LoginForm.ttAuthUID.value = document.LoginForm.ttAuthUID.value;<br />
      window.parent.opener.document.LoginForm.ttAuthPWD.value = document.LoginForm.ttAuthPWD.value;<br />
      document.LoginForm.RequestURL.value="StdPage&Template=loginformcln";<br />
    }<br />
  }<br />
  catch( er )<br />
  {<br />
    // Catch an error <br />
  }<br />
  return true;<br />
}<br />
  </script><br />
</head><br />
<body><br />
<form name="LoginForm" method="post" action="tmtrack.dll?LoginPage" onsubmit="return doSubmit()"><br />
<input type="hidden" name="RequestURL" value=""><br />
User<input class="frmTxt" type="text" name="ttAuthUID" size="35"><br><br />
Password<input class="frmTxt" type="password" name="ttAuthPWD" size="35"><br><br />
<input type="submit" name="Submit" value="Login"><br />
</input></br></input></br></input></input></form></body><br />
</html><br />


I know that by writing code like following would make it for me:

HttpWebRequest request;
HttpWebResponse response;
CookieContainer cookies;
 string url = string.Format("http://site.com/login?.login={0}&passwd={1}", cboUserName.Text, txtPassWord.Text);
request = (HttpWebRequest)WebRequest.Create(url);
request.AllowAutoRedirect = false;
request.CookieContainer = new CookieContainer();
response = (HttpWebResponse)request.GetResponse();
if (response.StatusCode != HttpStatusCode.Found)
{
//ToDo: if the page wasn't found raise Exception //instead of this textmessage MessageBox.Show("Something Wrong");
response.Close();
request.KeepAlive = false;
return;
}
cookies = request.CookieContainer;
response.Close();
request = (HttpWebRequest)WebRequest.Create(http://site.com/Reqyestedoage.html);
request.AllowAutoRedirect = false;
request.CookieContainer = cookies;
response = (HttpWebResponse)request.GetResponse(); using (Stream s = response.GetResponseStream())
{
StreamReader sr = new StreamReader(s);
string line;
while (!sr.EndOfStream)
{
//todo read the page contents
} 


Can anyone please tell me in my case what would be url ?
I am new to this; Any help would be appreciated.

Thanks,
AksharRoop
AnswerRe: Log Into Website using WebRequest Pin
Ben Fair13-Jan-09 6:52
Ben Fair13-Jan-09 6:52 
Questiontransaction history Pin
kralece12-Jan-09 20:51
kralece12-Jan-09 20:51 
AnswerRe: transaction history Pin
Wendelius12-Jan-09 22:59
mentorWendelius12-Jan-09 22:59 
AnswerRe: transaction history Pin
kralece13-Jan-09 0:56
kralece13-Jan-09 0:56 
AnswerRe: transaction history Pin
kralece14-Jan-09 2:32
kralece14-Jan-09 2:32 
QuestionWhere windows make temprary files? Pin
sumit703412-Jan-09 20:26
sumit703412-Jan-09 20:26 
AnswerRe: Where windows make temprary files? Pin
Vikram A Punathambekar12-Jan-09 20:29
Vikram A Punathambekar12-Jan-09 20:29 
GeneralRe: Where windows make temprary files? Pin
sumit703412-Jan-09 21:02
sumit703412-Jan-09 21:02 
QuestionUnable to connect: incorrect log on parameters. Pin
pbm41112-Jan-09 20:23
pbm41112-Jan-09 20:23 
AnswerRe: Unable to connect: incorrect log on parameters. Pin
thatraja10-Dec-11 17:10
professionalthatraja10-Dec-11 17:10 
QuestionTimer Class Pin
satsumatable12-Jan-09 20:06
satsumatable12-Jan-09 20:06 
AnswerRe: Timer Class Pin
Guffa12-Jan-09 20:24
Guffa12-Jan-09 20:24 
GeneralRe: Timer Class Pin
satsumatable12-Jan-09 20:28
satsumatable12-Jan-09 20:28 
GeneralRe: Timer Class Pin
N a v a n e e t h12-Jan-09 20:33
N a v a n e e t h12-Jan-09 20:33 
AnswerRe: Timer Class Pin
J a a n s12-Jan-09 20:32
professionalJ a a n s12-Jan-09 20:32 
AnswerRe: Timer Class Pin
musefan12-Jan-09 22:04
musefan12-Jan-09 22:04 
AnswerRe: Timer Class Pin
DaveyM6912-Jan-09 23:32
professionalDaveyM6912-Jan-09 23:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.