Click here to Skip to main content
12,404,178 members (79,650 online)
   

C#

 
QuestionCatching Line-out signal in C# Pin
Maquis.12-Jan-09 22:08
memberMaquis.12-Jan-09 22:08 
QuestionInstaller components in C# Pin
th3_d3vil12-Jan-09 21:59
memberth3_d3vil12-Jan-09 21:59 
AnswerRe: Installer components in C# Pin
rohan_puranik12-Jan-09 23:25
memberrohan_puranik12-Jan-09 23:25 
GeneralRe: Installer components in C# Pin
th3_d3vil13-Jan-09 0:29
memberth3_d3vil13-Jan-09 0:29 
QuestionHow to rotate a form in c#, or maybe just the controlls? Pin
maclinux12-Jan-09 21:09
membermaclinux12-Jan-09 21:09 
AnswerRe: How to rotate a form in c#, or maybe just the controlls? Pin
benjymous12-Jan-09 21:35
memberbenjymous12-Jan-09 21:35 
AnswerRe: How to rotate a form in c#, or maybe just the controlls? Pin
musefan12-Jan-09 21:58
membermusefan12-Jan-09 21:58 
QuestionLog Into Website using WebRequest Pin
AksharRoop12-Jan-09 21:07
memberAksharRoop12-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:

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

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
memberBen Fair13-Jan-09 6:52 
Questiontransaction history Pin
kralece12-Jan-09 20:51
memberkralece12-Jan-09 20:51 
AnswerRe: transaction history Pin
Mika Wendelius12-Jan-09 22:59
mvpMika Wendelius12-Jan-09 22:59 
AnswerRe: transaction history Pin
kralece13-Jan-09 0:56
memberkralece13-Jan-09 0:56 
AnswerRe: transaction history Pin
kralece14-Jan-09 2:32
memberkralece14-Jan-09 2:32 
QuestionWhere windows make temprary files? Pin
sumit703412-Jan-09 20:26
membersumit703412-Jan-09 20:26 
AnswerRe: Where windows make temprary files? Pin
Vikram A Punathambekar12-Jan-09 20:29
memberVikram A Punathambekar12-Jan-09 20:29 
GeneralRe: Where windows make temprary files? Pin
sumit703412-Jan-09 21:02
membersumit703412-Jan-09 21:02 
QuestionUnable to connect: incorrect log on parameters. Pin
pbm41112-Jan-09 20:23
memberpbm41112-Jan-09 20:23 
AnswerRe: Unable to connect: incorrect log on parameters. Pin
thatraja10-Dec-11 17:10
mvpthatraja10-Dec-11 17:10 
QuestionTimer Class Pin
satsumatable12-Jan-09 20:06
membersatsumatable12-Jan-09 20:06 
AnswerRe: Timer Class Pin
Guffa12-Jan-09 20:24
mvpGuffa12-Jan-09 20:24 
GeneralRe: Timer Class Pin
satsumatable12-Jan-09 20:28
membersatsumatable12-Jan-09 20:28 
GeneralRe: Timer Class Pin
N a v a n e e t h12-Jan-09 20:33
mvpN a v a n e e t h12-Jan-09 20:33 
AnswerRe: Timer Class Pin
J@@NS12-Jan-09 20:32
memberJ@@NS12-Jan-09 20:32 
AnswerRe: Timer Class Pin
musefan12-Jan-09 22:04
membermusefan12-Jan-09 22:04 
AnswerRe: Timer Class Pin
DaveyM6912-Jan-09 23:32
mvpDaveyM6912-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.


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 29 Jul 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid