Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Developers,

How to send username and password using windows application (C#) to particular URL.Below is the URL.

URL: https://secure.tmhp.com/TexMedConnect/[^]

In this link one POP up is opening for that pop up ID's also i am unable to track.Please help me how to send user name and password to this URL..


Thanks for advance...

Regards,
Aravind G
Posted
Updated 1-Sep-14 23:35pm
v3

1 solution

to Access URL in your windows application is some like this

first start a process to initiate the internet explorer like

System.Diagnostics.Process.Start("IExplore", "Pass your URL");


passing Parameters through URL like
VB
string url = "http://localhost/reportserver?/" +
             "AdventureWorks2012 Sample Reports/" +
             "Company Sales&rs:Command=Render";


Total Code looks like

C#
private void viewReportButton_Click(object sender, System.EventArgs e)
{
   // Build the URL access string based on values supplied by a user
   string url = serverUrlTextBox.Text + "?" + reportPathTextBox.Text +
      "&rs:Command=Render" + "&rs:Format=HTML4.0";

   // If the user does not check the toolbar check box,
   // turn the toolbar off in the HTML Viewer
   if (toolbarCheckBox.Checked == false)
      url += "&rc:Toolbar=False";

   // load report in the Web browser
   try
   {
      System.Diagnostics.Process.Start("IExplore", url);
   }

   catch (Exception)
   {
      MessageBox.Show(
         "The system could not open the specified report using Internet Explorer.",
         "An error has occurred", MessageBoxButtons.OK, MessageBoxIcon.Error);
   }
}
 
Share this answer
 
Comments
Aravind Garre 2-Sep-14 5:59am    
Hi Naveen,

Thanks for quick reply.

Can you please check the link.This link will open in browser as a PopUp Window.In that Pop up Username and password txtbox fields are there.Those txtbox fields i have to send through program and i have to click that button using Program only. Then it will redirect to home page.That home page URL i need through program.

My Main problem is i am unable to pass username and password for popup window. But i am able pass normal window.Below is sample how i am doing normal page.
control.WebBrowser.Document.GetElementById("ctl00_CPHContent_txtUserID").SetAttribute("value", str7);
control.WebBrowser.Document.GetElementById("ctl00_CPHContent_txtPassword").SetAttribute("value", str8);
control.WebBrowser.Document.GetElementById("ctl00_CPHContent_LoginButton").InvokeMember("click");

This was i have done using "WebBrowser control" in Windows application

Please help me on this...

Thanks for helping.

Regards,
Aravind G
vangapally Naveen Kumar 2-Sep-14 6:35am    
see this link you may get some idea

http://stackoverflow.com/questions/15901997/c-sharp-reach-click-button-in-webbrowser
Aravind Garre 2-Sep-14 6:41am    
This your correct, But this (https://secure.tmhp.com/TexMedConnect/) link i am unable to view source code to get the id's of username and password.

How can i see the view source to get the ID's of username and password.

Thanks for quick response Naveen..

Thanks,
Aravind G

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900