I have a windows application and i want to open my web application from this windows application. My Windows application will generate a key and machine code after authorization and will save the key and machine code in to database among active users. Now i want to send this key to browser so that my web application can identify the user with his machine.
How can i do this?
i cannot use URL because the user will be able to copy the URL and use my web application from another machine. I must restrict it.
Is there any other way?
Asked
Active
Viewed 9,948 times
0

Farook
- 35
- 3
- 10
-
What options have you looked at so far? Did you get errors? What were the errors? – Lotok Nov 29 '13 at 11:53
-
I tried by passing the value with the URL. But i cannot use it because of security risks.I simply don't no another way – Farook Nov 29 '13 at 11:55
-
Do the applications share a common database, maybe directly or through a service? – Markus Nov 29 '13 at 11:56
-
Yes, but unfortunately i cannot use it because of my requirements. i want to sent it directly from windowForms to WebForms. – Farook Nov 29 '13 at 11:59
-
[Passing data between Client Application and Web Application](http://stackoverflow.com/questions/7164580/passing-data-between-client-application-and-web-application)?? – huMpty duMpty Nov 29 '13 at 12:01
-
You can encrypt the query string, so it can't be read - http://stackoverflow.com/a/9110672/198048 – Mr Shoubs Nov 29 '13 at 12:07
-
Its reliability is up to you, you would be writing it. – Lotok Nov 29 '13 at 12:34
-
i cannot use URL because the user will be able to copy the URL and use my web application from another machine. I must restrict it. – Farook Nov 30 '13 at 04:55
3 Answers
0
you can POST data using c#
http://msdn.microsoft.com/en-us/library/debx8sh9(v=vs.110).aspx
see also this post in stackoverflow
-
I tried the second link, but how can i read that string from my web application? – Farook Nov 29 '13 at 12:09
-
you can read with every server side language like asp, php, etc... see how post works for it [asp](http://stackoverflow.com/questions/564289/read-post-data-submitted-to-asp-net-form), [php](http://www.w3schools.com/php/php_forms.asp) – Lanello Dec 02 '13 at 15:43
0
You can write an ashx handler and pass your data (or some reference to your data) from your windows application. Here is an example how this can be done :

Community
- 1
- 1

EngelbertCoder
- 777
- 2
- 9
- 29
0
There are Two Ways to transfer winform data to web applications
If you want to transfer the data to IE then You can Use
1)MSHtml.dll
code
InternetExplorer TargetIE = null;
IHTMLDocument2 document = null;
//Check whether the IE is opened
foreach (InternetExplorer internetExplorer in new ShellWindows())
{
if (internetExplorer.Document is HTMLDocument)
{
TargetIE = internetExplorer;
break;
}
}
2) If you want to transfer data from winform to any web browser my personal advice to you please use selenium for this. download the respective dll and driver for respective drivers from this site help
Code
using OpenQA.Selenium;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;
namespace WindowsFormsChrome
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// download the chrome driver
IWebDriver driver = new ChromeDriver(@"C:\Users\Downloads\chromedriver");
driver.Navigate().GoToUrl("http://www.yahoo.com");
IWebElement myField = driver.FindElement(By.Id("txtUserName"));
myField.SendKeys("UserName");
IWebElement myField = driver.FindElement(By.Id("txtPassword"));
myField.SendKeys("Password");
IWebElement myField = driver.FindElement(By.Id("btnLogin"));
myField.click()
}
}
}
this second part work for all browser yoou just replace chromeDriver class as per you want.

IMMORTAL
- 2,707
- 3
- 21
- 37