ASP.NET Quits Post and Not executing Button methods

Viewed 94

I have a weird state going on, I hope someone can help me understand. It doesn't seem to be a problem on my local machine. I can't reproduce it at all. Once I publish it to GoDaddy, it works fine for about 10 or so attempts, then quits posting during a search results. I go into the Dev Tools and this is what I see when it's working.

Successful Request Header

POST /sms.aspx HTTP/1.1
Host: accounts.anywaymessaging.com
Connection: keep-alive
Content-Length: 1175
Cache-Control: max-age=0
Origin: http://accounts.anywaymessaging.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://accounts.anywaymessaging.com/sms.aspx
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: ASP.NET_SessionId=oxaywle1ttxshxlhz4213dqa; AnywayMsg=SessionID=4DC189DB-639F-4F15-9580-F4E197C6055E

Successful Form Data

__VIEWSTATE=%2FwEPDwUJLTczMjQxMjk5D2QWAmYPZBYCAgMPZBYCAgEPZBYGAgEPDxYGHgRUZXh0BRpFbnRlciB5b3VyIHNlYXJjaCBjcml0ZXJpYR4IQ3NzQ2xhc3MFDU1lc3NhZ2VTZWFyY2geBF8hU0ICAmRkAg0PDxYCHgdWaXNpYmxlZ2RkAg8PDxYCHwNoZGQYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgYFKmN0bDAwJE1haW5Db250ZW50JGN0bDAyJGN0bDAxJGNoa1Bob25lSURfMQUqY3RsMDAkTWFpbkNvbnRlbnQkY3RsMDMkY3RsMDEkY2hrUGhvbmVJRF8xBSpjdGwwMCRNYWluQ29udGVudCRjdGwwNCRjdGwwMSRjaGtQaG9uZUlEXzIFKmN0bDAwJE1haW5Db250ZW50JGN0bDA0JGN0bDAyJGNoa1Bob25lSURfMwUqY3RsMDAkTWFpbkNvbnRlbnQkY3RsMDUkY3RsMDEkY2hrUGhvbmVJRF8yBSpjdGwwMCRNYWluQ29udGVudCRjdGwwNSRjdGwwMiRjaGtQaG9uZUlEXzPvxqxP2t7AR2NPGISth5gAC6gCQQSWFZKTuRoB4i%2ByVg%3D%3D
__VIEWSTATEGENERATOR=61D54015
__EVENTVALIDATION=%2FwEdAA3KY8iwC3SchtZa%2BhJ4vk3sZOgphDZcmnB6pJJ9qOUdhtfo3CKncsZOLGA4BvQGNRW6kLP4RbHpuFuwcTwWrQR81fh%2FXUFTtgMJaT8st%2Bn4LS8kePrLELX5WILj4FxliYJ1DTTEYS7ThpqL1ZXnH3qp793UO%2FrU2b3F%2BSVypjznlZJgraocwhIDauR3EkJNTnSKSiBcH244dTFtoKqbmNy9KOC6pxPTO3V2NoAkWjGKEINeivoCAKq90z1IaAALatXS%2Fva1qZEySGgoEEBy%2FMnRwdfH5f%2B2PnNQu1OPtJpRlUe%2FKw5rOkGskk3QcRPLQRw%3D
ctl00%24MainContent%24SearchType=First+Name
ctl00%24MainContent%24SearchFor=Gavin
ctl00%24MainContent%24SubmitButton=Search

Failed Request Header

POST /SMS.aspx HTTP/1.1
Host: accounts.anywaymessaging.com
Connection: keep-alive
Content-Length: 659
Cache-Control: max-age=0
Origin: http://accounts.anywaymessaging.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Referer: http://accounts.anywaymessaging.com/SMS.aspx
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: ASP.NET_SessionId=oxaywle1ttxshxlhz4213dqa; AnywayMsg=SessionID=E6C37891-711F-482C-A8AA-186D1AC81424

Failed Form Data

__VIEWSTATE=%2FwEPDwUJLTczMjQxMjk5D2QWAmYPZBYCAgMPZBYCAgEPZBYGAgEPDxYGHgRUZXh0BRpFbnRlciB5b3VyIHNlYXJjaCBjcml0ZXJpYR4IQ3NzQ2xhc3MFDU1lc3NhZ2VTZWFyY2geBF8hU0ICAmRkAg0PDxYCHgdWaXNpYmxlaGRkAg8PDxYCHwNoZGRkdevr7B%2Fbe77QB0dsrrmhG%2FEUUg8RBwxVImfFq5QsbNY%3D
__VIEWSTATEGENERATOR=61D54015
__EVENTVALIDATION=%2FwEdAAit83DFYOYQTsHWSO8TDCY1ZOgphDZcmnB6pJJ9qOUdhtfo3CKncsZOLGA4BvQGNRW6kLP4RbHpuFuwcTwWrQR81fh%2FXUFTtgMJaT8st%2Bn4LS8kePrLELX5WILj4FxliYJ1DTTEYS7ThpqL1ZXnH3qp793UO%2FrU2b3F%2BSVypjznlX1tjd1b5DoWbPIBmwacr1wQ7YlnCXd1W9fI%2FSD%2Ffv4d
ctl00%24MainContent%24SearchType=First+Name
ctl00%24MainContent%24SearchFor=Gavin
ctl00%24MainContent%24SubmitButton=Search

As you can see, only the __EVENTVALIDATION part is different. In the server side code, I made it simple, to verify this wasn't because of some other code and did this.

protected void Page_Load(object sender, EventArgs e)
{
    Javascript.ConsoleLog($"Page_Load: {Request.Form}");

    SubmitButton.Click += new EventHandler(this.SearchBtn_Click);
}

protected void SearchBtn_Click(Object sender, EventArgs e)
{
    Javascript.ConsoleLog($"SearchBtn_Click: {Request.Form}");
}

When it stops working, the SearchBtn is never fired and the Page_Load fires, but with no form data. Any idea what could possibly be causing this? At first, I thought it was caching, but I've put all kinds of no caching in the response data and in the HTML itself as meta tags. Any direction would be greatly appreciated. On and the Javascript.ConsoleLog is just a class I have to help track this problem and allows me to see if the method is being fired or not.

using System.Web;

namespace accounts.api
{
    static public class Javascript
    {
        static string scriptTag = "<script type=\"\" language=\"\">{0}</script>";
        static public void ConsoleLog(string message)
        {
            string function = "console.log('{0}');";
            string log = string.Format(GenerateCodeFromFunction(function), message);
            HttpContext.Current.Response.Write(log);
        }

        static public void Alert(string message)
        {
            string function = "alert('{0}');";
            string log = string.Format(GenerateCodeFromFunction(function), message);
            HttpContext.Current.Response.Write(log);
        }

        static string GenerateCodeFromFunction(string function)
        {
            return string.Format(scriptTag, function);
        }
    }
}
1 Answers

GoDaddy issue.. I found they were using old versions of Framework and was dying after so long. I had them move me over to new servers and I no longer have the issue.

Related