-2
  1. My first question is: what does it mean when I see html file in address along with question mark like if this was PHP script? - file.html?object=value -html file is not a script. If it was PHP script - ok, but this is simple HTML file. Is this possible?

  2. Example google link: https://www.google.pl/?gfe_rd=cr&ei=pShQVdD6HLSo9febv4CYBQ&gws_rd=ssl - what does (again) the question mark mean here? ('/?object=value'). Again, there is no script to pass any params this way - or maybe I'm wrong and there is a script with no name like 'default' or something.

I am trying to invoke a script from C# code using WebBrowser.InvokeScript and I would like to understand this Web mechanism better.

Regards;

  • 1
    (1) apache servers can be changed to parse php scripts in html files - see http://stackoverflow.com/questions/6295141/server-not-parsing-html-as-php (2) if `index.php` (or `index.html` as in #1) is the default, you can leave it out and just do `/?...` – Sean May 11 '15 at 04:12
  • It's a way to pass values to the page you're going to. In PHP, you can access those variables in the `$_GET` super global array. – Darren May 11 '15 at 04:28
  • WebBrowser.InvokeScript has nothing to do with query strings... Please clarify. Are you trying to load an external page from your c# code? Also, why the javascript and php tags in your question and no c# tag? This is a mess. – Capsule May 11 '15 at 04:59

1 Answers1

0

file.html?object=value - Query strings are one of the means by which you can pass information from the browser to the server-side application or to even a static page (not recommended in address bar for security reasons).

Characters after the question mark are a HTTP query string, any HTTP query string can contain both variables and their values. The HTTP query string contains a variable named "object" with the value "value".

What can you do with such query string?

  1. Read the Query String
  2. Parse the Query String, and
  3. URL Encode & Decoding the Query String

To get the value of a query string value you can do like - Request.QueryString("object")

Sunil Kumar
  • 1,718
  • 16
  • 33
  • Thank You guys. Sean's response is the one I like best. 1. I was not asking about Query String and what this is. I asked about this particular case when there is no script name defined and there is only '/?'. Another issue was that html file can be treated like PHP when script inside html file is about to be parsed by for example Apache - 'html?' 2. Why no C# tag - C# was just additional information to get the context. I asked about the web mechanism. – Bruce Wayne May 11 '15 at 09:27
  • Sorry, but you mentioned - what does it mean when I see html file in address along with question mark like if this was PHP script? that itself explains you may not be aware of what a query string is, I suggest you must update your primary question if you already know about query string and its mechanism. Now your comment sounds contradictory for other readers. – Sunil Kumar May 11 '15 at 09:31