Windows Develop Bookmark and Share   
 index > Windows Forms General > Want to get Data which is return by typing any URL with certain specification
 

Want to get Data which is return by typing any URL with certain specification

Hi to All,

Lang:- C Sharp.
Type:-Windows Application.


NOw i just want the data which i get by typing any URL.

for example:-

try

{

System.Windows.Forms.WebBrowserChkStatus= new System.Windows.Forms.WebBrowser();

ChkStatus.Navigate("http://MySite.Com//login.php?usr=" + frmMain._userID + "&pwd=" + frmMain._LoginPass );

}

catch (Exception ex)

{

MessageBox.Show("Error");

}

finally

{

}



1. Now when i do this it may logedin or Loged Out i nt able to catch it ( any Idea How it can Be possible in my application)

2. If i m using the above code and add some addition code(i already have) which give me result / responce in browser like the following :

66 Msg in inbox , 8 Jan 2009

how to display this browser responce by using any message box or label in Windows c# application.





Thankz and regards, in advance

Praveen Solanki.


i m Doing Software Engi.(GNIIT).. I Lov 2 Do Programming...n i Want be a HacKer..
PraveenRockz  Friday, January 09, 2009 5:55 AM
If I understood you correctly... you'd need to wait for the document to fully load (adding a DocumentComplete event handler), and, on that handler, parse the document as you wish.

On your example (in bold, the added things):

private void LoadDocument()
{
try
{
System.Windows.Forms.WebBrowser ChkStatus = new System.Windows.Forms.WebBrowser();
ChkStatus.DocumentCompleted += ShowDocumentOnAMessageBox;
ChkStatus.Navigate("http://MySite.Com//login.php?usr=" + frmMain._userID + "&pwd=" + frmMain._LoginPass );
}
catch (Exception ex)
{
MessageBox.Show("Error");
}
finally
{
}
}

private void ShowDocumentOnAMessageBox(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
MessageBox.Show(((WebBrowser)sender).DocumentText);
((WebBrowser)sender).Dispose();
}



Before I speak, I have something important to say.
  • Marked As Answer byPraveenRockz Sunday, January 11, 2009 5:42 AM
  •  
Javier Campos  Friday, January 09, 2009 10:13 AM
If I understood you correctly... you'd need to wait for the document to fully load (adding a DocumentComplete event handler), and, on that handler, parse the document as you wish.

On your example (in bold, the added things):

private void LoadDocument()
{
try
{
System.Windows.Forms.WebBrowser ChkStatus = new System.Windows.Forms.WebBrowser();
ChkStatus.DocumentCompleted += ShowDocumentOnAMessageBox;
ChkStatus.Navigate("http://MySite.Com//login.php?usr=" + frmMain._userID + "&pwd=" + frmMain._LoginPass );
}
catch (Exception ex)
{
MessageBox.Show("Error");
}
finally
{
}
}

private void ShowDocumentOnAMessageBox(object sender,
WebBrowserDocumentCompletedEventArgs e)
{
MessageBox.Show(((WebBrowser)sender).DocumentText);
((WebBrowser)sender).Dispose();
}



Before I speak, I have something important to say.
  • Marked As Answer byPraveenRockz Sunday, January 11, 2009 5:42 AM
  •  
Javier Campos  Friday, January 09, 2009 10:13 AM
Oh, the answer to "1" is basically the same... you might check for the browser's response and parse it... the broswer should return if you are logged in or not on the call.

By the way, if "_userID" and "_LoginPass" are user-definable, you might check for injections in the code... best way is to escape them usingSystem.Web.HttpUtility.UrlEncode()


Before I speak, I have something important to say.
Javier Campos  Friday, January 09, 2009 10:18 AM

You can use google to search for other answers

Custom Search

More Threads

• IViewObject + SetAdvise Not Working
• i have question with group box
• Problem Painting Custom Tab Control
• Form Still Closes After Textbox Validation Fails
• Multi-Header DataGridView
• MainMenu control does NOT upgrade to MenuStrip Control?
• Windows Forms Multi-Threading
• How to handle HTTP Errors occur in WebBrowser Control?
• Custom message box mouse capture problem related to UltraCombo
• A little trouble with custom controls