Barun
Barun

Reputation: 1915

C# Problem sending post httpwebrequest with 'input type image'

I am sending a post request by HttpWebRequest. There is a element which is a input type=image. There is no other value of this element. But when I sending request with browser it is adding a .x and .y value into it. But in source page I cant find it. Here is the element

<input type="image" name="ctl00$ContentPlaceHolder1$gvResults$ctl02$ibImg" id="ctl00_ContentPlaceHolder1_gvResults_ctl02_ibImg" src="images/image.gif" alt="Document Image: 128 Pages" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$gvResults$ctl02$ibImg&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, false))" style="height:16px;width:13px;border-width:0px;">

I am tracking it with a sniffer tool. And It is sending post data like that

&ctl00%24ContentPlaceHolder1%24gvResults%24ctl02%24ibImg.x=3&ctl00%24ContentPlaceHolder1%24gvResults%24ctl02%24ibImg.y=12

I hope I make my self clear. Am I missing something ?

Thanks

Upvotes: 0

Views: 684

Answers (2)

David
David

Reputation: 73564

http://webdesign.about.com/od/htmltags/p/input-image-tag.htm

The image INPUT tag uses an image as an input fields. The image can be used as a submit button (with a script to submit the form onclick) or to collect data from the image itself (similar to an image map, but in a form). The browser will submit the coordinates where the user clicked on the image.

bold added by me for emphasis

Upvotes: 2

Josh
Josh

Reputation: 69262

That is by design. The browser is adding those extra post variables.

In HTML forms, an input of type image will send the x and y coordinates where the mouse clicked on the image along with the post. This was commonly done to implement server-side image maps.

Upvotes: 1

Related Questions