mr.abuasbe Posted January 29, 2016 Share Posted January 29, 2016 hi, i'm trying to make contact form, i'm working with html and i have Linux server. now when i press submit button i'm getting HTTP Error 405.0 - Method Not Allowed <form role="form" action="assets/contact.php" method="post"> <div class="form-group"> <label class="sr-only" for="contact-email">Email</label> <input type="text" name="email" placeholder="Email..." class="contact-email form-control" id="contact-email"> </div> <div class="form-group"> <label class="sr-only" for="contact-subject">Subject</label> <input type="text" name="subject" placeholder="Subject..." class="contact-subject form-control" id="contact-subject"> </div> <div class="form-group"> <label class="sr-only" for="contact-message">Message</label> <textarea name="message" placeholder="Message..." class="contact-message form-control" id="contact-message"></textarea> </div> <div class="form-group"> <label for="contact-antispam">Antispam question: 7 + 5 = ?</label> <input type="text" name="antispam" placeholder="Your answer..." class="contact-antispam form-control" id="contact-antispam"> </div> <button type="submit" class="btn">Send message</button> </form> HTTP Error 405.0 - Method Not Allowed The page you are looking for cannot be displayed because an invalid method (HTTP verb) is being used. Most likely causes: The request sent to the Web server used an HTTP verb that is not allowed by the module configured to handle the request. A request was sent to the server that contained an invalid HTTP verb. The request is for static content and contains an HTTP verb other than GET or HEAD. A request was sent to a virtual directory using the HTTP verb POST and the default document is a static file that does not support HTTP verbs other than GET or HEAD. Things you can try: Verify the list of verbs enabled for the module handler this request was sent to, and ensure that this verb should be allowed for the Web site. Check the IIS log file to see which verb is not allowed for the request. Check the failed request tracing logs for additional information about this error. For more information, click here. Detailed Error Information: Module StaticFileModule Notification ExecuteRequestHandler Handler StaticFile Error Code 0x80070001 Requested URL http://localhost:35840/assets/contact.php Physical Path C:\Users\Omar\Desktop\XPOZ\assets\contact.php Logon Method Anonymous Logon User Anonymous Request Tracing Directory C:\Users\Omar Abu Asbe\Documents\IISExpress\TraceLogFiles\XPOZ More Information: This error means that the request sent to the Web server contained an HTTP verb that is not allowed by the configured module handler for the request. View more information » ANY HELP ?! 1 Link to comment Share on other sites More sharing options...
siam Posted January 29, 2016 Share Posted January 29, 2016 did your contact.php was ok ? Link to comment Share on other sites More sharing options...
dsonesuk Posted January 29, 2016 Share Posted January 29, 2016 Sounds as though its a problem with Windows IIS butting its nose in where its not required. If you have windows, and iis is present, try to disable it completely. Link to comment Share on other sites More sharing options...
mr.abuasbe Posted January 29, 2016 Author Share Posted January 29, 2016 this my contact.php jQuery(function($) { $("#contact_form").submit(function() { var email = $("#email").val(); // get email field value var name = $("#name").val(); // get name field value var msg = $("#msg").val(); // get message field value $.ajax( { type: "POST", url: "https://mandrillapp.com/api/1.0/messages/send.json", data: { 'key': 'sVRLFidC1A7K56TuUkyUQg', 'message': { 'from_email': email, 'from_name': name, 'headers': { 'Reply-To': email }, 'subject': 'Website Contact Form Submission', 'text': msg, 'to': [ { 'email': 'mr.abuasbe@gmail.com', 'name': 'Riyadh Al Nur', 'type': 'to' }] } } }) .done(function(response) { alert('Your message has been sent. Thank you!'); // show success message $("#name").val(''); // reset field after successful submission $("#email").val(''); // reset field after successful submission $("#msg").val(''); // reset field after successful submission }) .fail(function(response) { alert('Error sending message.'); }); return false; // prevent page refresh }); }); and windows iis is disabled ! (see attached photo) Link to comment Share on other sites More sharing options...
mr.abuasbe Posted January 29, 2016 Author Share Posted January 29, 2016 if some one can give me ready code i will be happy.. i need to finish this thanks Link to comment Share on other sites More sharing options...
dsonesuk Posted January 29, 2016 Share Posted January 29, 2016 Don't believe such thing really means its fully disabled... we are talking about MS here :-) Check in control panel -> Administrator tools -> Services -> scroll down to World Wide Publishing Service does it still exist? if so does it show as disabled. Also you might have problem transferring from 'http' to 'https', it treated as not secure, and usually throws error. Link to comment Share on other sites More sharing options...
mr.abuasbe Posted January 29, 2016 Author Share Posted January 29, 2016 no its really not there, the same error also when i upload the website .. what should id do ?! i'm making a business site to friend and i promised him to finish it today, but this contact form make me disappointed Link to comment Share on other sites More sharing options...
dsonesuk Posted January 29, 2016 Share Posted January 29, 2016 Hang on...where is you name field coming from? Link to comment Share on other sites More sharing options...
mr.abuasbe Posted January 29, 2016 Author Share Posted January 29, 2016 i know there are differents... because i changed it.. know the names are equal to the contact.php but still not working Link to comment Share on other sites More sharing options...
mr.abuasbe Posted January 29, 2016 Author Share Posted January 29, 2016 i tried now this code from the web, and the same problem .. i can't run it ... (i'm trying locally now) <?php $field_name = $_POST['cf_name']; $field_email = $_POST['cf_email']; $field_message = $_POST['cf_message']; $mail_to = 'mr.abu@gmail.com'; $subject = 'Message from a site visitor '.$field_name; $body_message = 'From: '.$field_name."\n"; $body_message .= 'E-mail: '.$field_email."\n"; $body_message .= 'Message: '.$field_message; $headers = 'From: '.$field_email."\r\n"; $headers .= 'Reply-To: '.$field_email."\r\n"; $mail_status = mail($mail_to, $subject, $body_message, $headers); if ($mail_status) { ?> <script language="javascript" type="text/javascript"> alert('Thank you for the message. We will contact you shortly.'); window.location = 'contact_page.html'; </script> <?php } else { ?> <script language="javascript" type="text/javascript"> alert('Message failed. Please, send an email to gordon@template-help.com'); window.location = 'contact_page.html'; </script> <?php } ?> <form action="contact.php" method="post"> Your name<br> <input type="text" name="cf_name"><br> Your e-mail<br> <input type="text" name="cf_email"><br> Message<br> <textarea name="cf_message"></textarea> <br> <input type="submit" value="Send"> <input type="reset" value="Clear"> </form> Link to comment Share on other sites More sharing options...
dsonesuk Posted January 29, 2016 Share Posted January 29, 2016 I just tested it and it works, so it must be some setting somewhere, causing it to fail. Have you done the following? restart pc, restart all services on server, clear browser cache . Link to comment Share on other sites More sharing options...
Chikwado Posted January 31, 2016 Share Posted January 31, 2016 (edited) That code works perfectly, I have tested it in window 8 with IE9. Edited January 31, 2016 by Chikwado Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now