Error: 405 When accessing HTML page after Form submission - html

I am trying to post a dimple FORM in HTML as mentioned below:
<form name="myform" method="post" action="Home.html" onsubmit="return validateform()" >
<label class="labelText">
Name: </label>
<input class="textBoxName" type="text" name="name"><br/>
<label class="labelTextPassword"> <br/>
Password:</label>
<input type="password" name="password"><br/>
<input class="loginButton" type="submit" value="Login">
</form>
Its working successfully on my SYSTEM. but when I hosted my site on Azure, after validating name and password its not re-directing to "Home" Page. It shows error
as:
The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used. (Error: 405)
Can please anyone have any idea about this issue?

405 means Method not allowed.
It means that Home.html cannot accept a POST request
So try using the get method while sending the data and it would work.

Related

Embeded HTML post form data in angular application

In third party portal, if we click on button it redirect to my angular application. Issue is when the user click on that button it pass the post data and I want to capture that post data in my angular application. I tried certain ways but it does not seems to work for me. Kindly help me to resolve this issue.
Below is the form structure which I receive from the third party vendor.
<form id="ApplicationRedirectForm" encType="application/x-www-form-urlencoded" method="post" name="login" action="http://localhost:4200/" target="_blank">
<input name="login" value="test" type="hidden">
<input name="country" value="testcountry" type="hidden">
<input name="city" value="testcity" type="hidden">
<input type="submit" value="submit">
</form>
Note: to test it on my local machine I have added button and actions as localhost:4200
Please let me know if more details are required here.
Thanks in Advance.

HTML E-mail form

So my site is almost done but I'm stuck on the part of sending an email.
Everything works, when I fill in the fields. But it always gets saved as a draft so I don't receive the email.
Here is my html code:
This code is copied from a site.
<form action="mailto:myemailadress#gmail.com" method="post" enctype="text/plain">
Name:<br>
<input type="text" name="name"><br>
E-mail:<br>
<input type="text" name="mail"><br>
Comment:<br>
<input type="text" name="comment" size="50"><br><br>
<input type="submit" value="Send">
<input type="reset" value="Reset">
</form>
action="mailto:myemailadress#gmail.com" <-- This is not correct.
You'll have to point your post submission to a handler php file that will process the form request and submit the email.
Now, some host providers do have a php mailer to make us things easier, e.g godaddy https://www.godaddy.com/es/help/using-our-php-form-mailers-on-web-and-classic-hosting-8376 .
An example of php mail handler for forms can be found here http://www.freecontactform.com/email_form.php . It has some validation code too.
There is a possibility that you're using a server that doesn't support PHP but ASP, .NET, Node.js or some other, in that case i can't help you because i'm not familiar to none of them :)

In-page form does not send data to remotely hosted aspx form

I have an html form with the action linking to a remotely hosted aspx form. The html form mimics all the input names, ids, values, etc. of the aspx form.
After submitting the html login form with correct login data, instead of processing the data and redirecting to the target link, the page links to the raw login form with only the username data entered. Upon filling in the correct information again, the user is able to log in.
By checking the function of the other instances of the same login form on the site and encountering the same problem, I surmised that the issue is inherent in the remote aspx file, not the html form.
The form was working until about a week ago, when it promptly started behaving like this without any changes made to the code.
The live site is at http://blinqphoto.com
Thank you for any responses, this has me stumped.
Please find the html form and corresponding aspx form below.
HTML:
<form style="" name="LoginForm" method="post" action="https://acct.blinqphoto.com/loginframe.aspxredirect=http%3a%2f%2fwww.blinqphoto.com%2fmy-albums%2f" id="LoginForm">
<div>
<input name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMjU0ODEwOTIzZGR61068oyJyEBB4UM9Gc8Fxx4225NLn2XmKWX95/vl6Zg==" type="hidden">
</div>
<div>
<input name="__EVENTVALIDATION" id="__EVENTVALIDATION"value="/wEWBAL1/8vwCgKTqJrlAQKN8oRJAv6M0J8PQkj11RCPtUGzghOj3yic+Mr17E559GJ73UVSHbxO9VE=" type="hidden">
</div>
<span> Email <input name="UserNameTxt" id="UserNameTxt" placeholder="example#gmail.com" type="text"></span>
<br>
<span>Password<input name="PasswordTxt" id="PasswordTxt" placeholder="password" class="password" type="password"></span>
<br>
<input name="LoginButton" value="Sign in" class="LoginButton" type="submit"><br>
</form>
aspx:
<form style="" name="LoginForm" method="post" action="https://acct.blinqphoto.com/loginframe.aspx?redirect=http%3a%2f%2fwww.blinqphoto.com%2fmy-albums%2f" id="LoginForm">
<div>
<input name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJMjU0ODEwOTIzZGR61068oyJyEBB4UM9Gc8Fxx4225NLn2XmKWX95/vl6Zg==" type="hidden">
</div>
<div>
<input name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAL1/8vwCgKTqJrlAQKN8oRJAv6M0J8PQkj11RCPtUGzghOj3yic+Mr17E559GJ73UVSHbxO9VE=" type="hidden">
</div>
<span> Email <input name="UserNameTxt" id="UserNameTxt" placeholder="example#gmail.com" type="text"></span>
<br>
<span>Password<input name="PasswordTxt" id="PasswordTxt" placeholder="password" class="password" type="password"></span>
<br>
<input name="LoginButton" value="Sign in" class="LoginButton" type="submit"><br>
</form>
I believe this is due to the .NET event validation. If you look closely, the value of the __EVENTVALIDATION form field is not always exactly the same. This is used to validate the postback - to check that it is not coming from another URL for example, which is exactly what you are doing.
You need to disable the event validation for the login.aspx page.
Page.EnableEventValidation = false;
Is there a way to disable Event Validation for an entire page?
Note that disable event validation can possibly make your page more vulnerable.

Username and password appearing in the URL

In my rails app, I have a login page like this:
<body>
<form action="/my_app/homepage" method="get" class="navbar-form pull-left">
<input name="username" type="text" class="span2">
<input name="password" type="password" class="span2">
<button type="submit" class="btn">Submit</button>
</form>
</body>
When I click on the Submit button it takes me to the /my_app/homepage but at the same time it also displays the username and password in the addressbar.
Am I doing it the wrong way? How can I avoid displaying the username & password?
That is because the Http Request method of FORM is GET. Which would always show the form data in the URL. To hide the data of the form, you need to use POST request.
Change the code to the following:
<form action="/my_app/homepage" method="post" class="navbar-form pull-left">
<input name="username" type="text" class="span2">
<input name="password" type="password" class="span2">
<button type="submit" class="btn">Submit</button>
</form>
Check the method="post" and you'll get the URL only without any sort of Query String.
The GET method will append the form variables to the URL, using the POST method. From W3Schools:
"POST is a little safer than GET because the parameters are not stored in browser history or in web server logs." Also "Data is not displayed in the URL".
http://www.w3schools.com/tags/ref_httpmethods.asp

Debug a Http 405 "Method Not Allowed"

A web server is running (on EC2) and I'm testing this simple Html5 login form with a method="post" attribute in two ways:
as-is
within a larger website
<div>
<form action="" method="post" >
<p/>
<input id="username" type="text" name="username" placeholder="Username" >
<p/>
<input id="password" type="password" name="password" placeholder="Password" >
<p/>
<input type="submit" class="btn" value="Login">
</form>
</div>
A handler in the Python-based web server includes:
username = self.get_argument('username')
password = self.get_argument('password')
The first method works with a Http 200 but the second generates a Http 405 "Method Not Allowed". Both use the identical handler code on the web server.
I cannot find where the problem is. What is the best way to debug this?
The problem was with the web-server and the order of the parameters/attributes for the Class function handling the Post method.