Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could set up your site to accept a query parameter that is called MACAddress. Have the desktop app POST to the website; POSTing the value of the cookie. This may help:</p> <pre><code>using System.Net; ... var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.UseDefaultCredentials = true; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; httpWebRequest.Method = "POST"; byte[] requestBytes = Encoding.UTF8.GetBytes(queryString); httpWebRequest.ContentLength = requestBytes.Length; using (var requestStream = httpWebRequest.GetRequestStream()) { requestStream.Write(requestBytes, 0, requestBytes.Length); requestStream.Close(); } </code></pre> <p>The query string will look like</p> <pre><code>"MACAddress=" + macAdd </code></pre> <p>-------------update upon request---------------</p> <p>Within your Desktop Application, add the using statement. You may need to add the reference to the Dll within solution explorer too.</p> <p>Then, make a method called PostMacAddress as follows:</p> <pre><code>public void PostMacAddress(string url, string macAdd) { var httpWebRequest = (HttpWebRequest)WebRequest.Create(url); httpWebRequest.UseDefaultCredentials = true; httpWebRequest.ContentType = "application/x-www-form-urlencoded"; httpWebRequest.Method = "POST"; var queryString = "MACAddress=" + macAdd; byte[] requestBytes = Encoding.UTF8.GetBytes(queryString); httpWebRequest.ContentLength = requestBytes.Length; using (var requestStream = httpWebRequest.GetRequestStream()) { requestStream.Write(requestBytes, 0, requestBytes.Length); requestStream.Close(); } } </code></pre> <p>I'm not sure what it is you're not understanding (not trying to be mean). I'm simplifying here, but, POSTing is an HTTP protocol for sending data to a website. Another one is GET (protocol for reading data).</p> <p>Hope that helps!</p> <p>-------updating to show the web side...-----------</p> <p>In your Page_Load method, you'll want to get the QueryString like this:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (!String.IsNullOrEmpty(Request.QueryString["MACAddress"]) lblMacAddress.Text = Request.QueryString["MACAddress"]; } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload