http form post change submit data - c#

<FORM id=loginForm name=loginForm method=post
action="http://www.example.com/login.php">
<INPUT name=username>
<INPUT name=password>
<INPUT type=submit value="Log In" name=action_login>
</FORM>
Is there any way of changing name=action_login to name=action_signup and post username and password to http://www.example.com/signup.php
in the server site it has name=action_login but I would like to change this on the client side and not touch the server site.

If you are using FireFox, get the Firebug addon which lets you modify markup in real-time.
Chrome has a built-in similar tool.
Right click -> Inspect Element

Related

Login to HTTPS website programmatically using C# with form values in Hebrew

I'm trying to login to a website that has authentication form
<form name="logon" action="login.php" method="POST" >
<input type="text" name="id_num" value="">
<input type="password" name="password" value="">
<input type="submit" value="התחברות" name="connect">
</form>
I also snipped the data with Data Tamper.
Data Tamper shows the the keys and values and for connect is shows %D7%94%D7%AA%D7%97%D7%91%D7%A8%D7%95%D7%AA that is the url encoding for that word.
I'm unable to login with C# code apprerantly because of the submit button with the Hebrew value.
any help?
Create a View Model for this form with a property for the submit. Then, upon processing, check to see if the value for the submit property is null.

Form post method complete coding

Following is the HTML form code, for uploading text value and a JPEG file.
<html>
<head></head>
<body>
<form action="https://mywebsiteforexample.com/" method="post" enctype="multipart/form-data">
<input type="text" name="id" value="01"/>
<input type="file" name="image">
<input type="submit" value="send">
</form>
</body>
</html>
Problem is whenever I have to upload the file on server, I need to manually browse the file to upload it. I want to write the same code in C# so when I run the code it itself select the file by path given, and upload the file so I don't need to browse and select the file manually. Is it possible.
You don't need to write code that fills input elements (if you want, use Selenium with C# driver). Just simulate POST action from simple console application using for e.g. HttpClient.
There are plenty of questions on SO how to do it, e.g. C# HttpClient 4.5 multipart/form-data upload

ASP.NET - Using SagePay Form Method Within a Content Page

I have an ASP.NET site and need to post some hidden form fields to SagePay so that my customers can pay for goods. I am using the following method to do this:
<input type="hidden" name="VPSProtocol" value="2.23" />
<input type="hidden" name="Currency" value="gbp" />
<input type="hidden" name="TxType" value="PAYMENT" />
<input type="hidden" name="Vendor" value="myvendorname" />
<input type="hidden" runat="server" id="crypt" name="Crypt" value="#<encrypted string>" />
<asp:Button ID="Button1" runat="server" Text="Pay Now" PostBackUrl="https://live.sagepay.com/gateway/service/vspform-register.vsp"/>
Now, If I use this code in a standard ASP.NET form, this works fine - SagePay accepts the posted information and continues with the payment process. However, if I use the same code inside a content page with a master page, Sagepay displays the following error screen:
5030 : We could not process your message, please check your
integration settings or contact the support team.
It seems as if the hidden fields are losing their value because of the master page.
Could anyone tell me what could be happening here and if there is anything I can do to rectify the situation. I need to use the SagePay Form method and I need to use a masterpage.
I haven't used webforms for a while but from memory by default it changes the names of your elements based on their container to allow navigation and identification server side: MSDN documentation here.
This means that your posted values are not under the name you expect them to be.

Reddit bot - either bypass or click "yes" to over 18 check?

I am making a Reddit comment bot that will crawl subreddits as it finds links in the pages. My problem is that when I try to crawl NSFW subreddits with an 18+ age question, despite clicking "yes" in my normal browser, Reddit returns a 18+ age question every time the C# bot hits those pages.
Is there a way to avoid this or to click the "yes" button programatically?
yes there is a way, look at the HTML form for the question:
<form method="post" action="" class="pretty-form">
<input type="hidden" name="uh" value="">
<p>are you over eighteen and willing to see adult content?</p>
<p>
<button type="submit" name="over18" value="yes">yes</button>
<button type="submit" name="over18" value="no">no</button>
</p>
</form>
You could fill out the values and then submit the POST request.

How to disable angularjs from capturing my form submit for the second submit button

Thanks for checking.
I am building a web application using angularjs. i have two buttons one will do a Ajax post to server using angularjs and the other will to a normal html post to server. the reason i want the second one to do a direct post to server is that i want to generate an excel document on server and return it tp user to download on response.
please how can i disable angularjs from capturing my form submit for the secont submit button
I'd say that the simplest way is to change the button that shouldn't post the form to not be a form button, but another element that doesn't have that default behaviour. That is, change this:
<form>
<input type="text">
<input type="submit" ng-click="doStuff()" value="Ajaxy things">
<input type="submit" value="Real post">
</form>
to:
<form>
<input type="text">
<a ng-click="doStuff()">Ajaxy things</a>
<input type="submit" value="Real post">
</form>
And style the a to look like a button.

Categories

Resources