Baji
Baji

Reputation: 131

Getting 404 error after sending username and password as post requests

I have some jmeter script the main purpose of this script is to post the username and password that I read from excel sheet. I have excel sheet saved in E:\ drive of my local system and I am successfully sending post requests by reading username and password from the excel but I am getting issue in the response received.Please help me.

Response data:

<!DOCTYPE html>
<html>
    <head>
        <title>The resource cannot be found.</title>
        <meta name="viewport" content="width=device-width" />
        <style>
         body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} 
         p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
         b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
         H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }
         H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon }
         pre {font-family:"Consolas","Lucida Console",Monospace;font-size:11pt;margin:0;padding:0.5em;line-height:14pt}
         .marker {font-weight: bold; color: black;text-decoration: none;}
         .version {color: gray;}
         .error {margin-bottom: 10px;}
         .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }
         @media screen and (max-width: 639px) {
          pre { width: 440px; overflow: auto; white-space: pre-wrap; word-wrap: break-word; }
         }
         @media screen and (max-width: 479px) {
          pre { width: 280px; }
         }
        </style>
    </head>

    <body bgcolor="white">

            <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1>

            <h2> <i>The resource cannot be found.</i> </h2></span>

            <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

            <b> Description: </b>HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. &nbsp;Please review the following URL and make sure that it is spelled correctly.
            <br><br>

            <b> Requested URL: </b>/Account/Authenticate/<br><br>

    </body>
</html>

Request:-

POST http://pulsedindev.halcyontek.com/Account/Authenticate/

POST data:
DeviceType=5&Password=halcyon12%24&Username=test04.pharma%40gmail.com

[no cookies]

Request Headers:
Connection: keep-alive
Accept-Language: en-US,en;q=0.5
Accept: application/json, text/plain, */*
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0
Referer: http://pulsedindev.halcyontek.com/
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 69
Host: pulsedindev.halcyontek.com

Upvotes: 0

Views: 522

Answers (1)

Richard Friedman
Richard Friedman

Reputation: 942

I found the issue with your test - your server is expecting GET, not POST for passing the username and password. This is a bad practice I would suggest it be POST and over HTTPS.

How did I figure this out

  1. I used a SeleniumIDE + JMeter Recorder to simulate the traffic and record a Selenium and JMeter
  2. I played the test in JMeter and there was no issue.

If you want here is a copy of the Selenium recorded test plan and simple JMeter test plan for your site.

Upvotes: 1

Related Questions