ASPX Default ButtonsRSS

4 replies

Last post 11 hours, 28 minutes ago by jeffrey.daro

  • ASPX Default Buttons

    Oct 09, 2020 09:21 PM|jeffrey.daro|LINK

    I have a .NET 4.8 application deployed in a subdomain https://THIS.domain.com. The code has been deployed here for years, and has worked fine. We recently set up https://THAT.domain.com. We deployed the same code base there. In the THAT subdomain when the user clicks the Login button on the default.aspx page, they can login fine. If they hit the enter key, the page refreshes, doesn't cause a post-back and doesn't submit the page.

    I originally had this problem years ago when using shared hosting on GoDaddy. There was an IIS setting that they changed that caused this issue for us. They would not tell us what they changed, but said they could not undo the change because it would affect all customers on the shared box. We moved to another hosting company and everything has been fine. We recently consolidated our test environments down to a subdomain and the problem came back.

    I am flummoxed.

    2020-10-30 - Additional information - I have narrowed the problem a bit more. If I deploy the code to https://subdomain.domain.com/, it works fine. If I deploy the code to https://subdomain.domain.com/folder/, the problem occurs.

  • Re: ASPX Default Buttons

    Oct 12, 2020 02:06 AM|Brucz|LINK

    Hi jeffrey.daro,

    When you moved to another hosting company, can you login fine by clicking the login button? Because different shared server hosting companies adopt different management strategies, it is impossible to determine whether they have made special settings for IIS.

    But I think your problem can be improved from the code level. In JS or JQuery, you can set the enter key binding event to prevent it from refreshing the page or binding to a certain button. When you click the enter key, the form can be submitted.

    // Get the input field
    var input = document.getElementById("myInput");
    
    // Execute a function when the user releases a key on the keyboard
    input.addEventListener("keyup", function(event) {
      // Number 13 is the "Enter" key on the keyboard
      if (event.keyCode === 13) {
        // Cancel the default action, if needed
        event.preventDefault();
        // Trigger the button element with a click
        document.getElementById("myBtn").click();
      }
    });

    Best regards,

    Brucz

  • Re: ASPX Default Buttons

    Oct 23, 2020 03:43 AM|mikahawkins|LINK

    Hello,

    The Button control is used to display a push button. The push button may be a submit button or a command button. By default, this control is a submit button.A submit button does not have a command name and it posts the page back to the server when it is clicked. It is possible to write an event handler to control the actions performed when the submit button is clicked.A command button has a command name and allows you to create multiple Button controls on a page. It is possible to write an event handler to control the actions performed when the command button is clicked.

    Regards,

    Mika Hawkins

    Hello everyone. This is Mika Hawkins. I am 31 years old. I am from Canada. I am a teacher. I like to read books.
  • Re: ASPX Default Buttons

    11 hours, 29 minutes ago|jeffrey.daro|LINK

    Brucz, thanks for the reply and the sample code. I may have to solve this with code, but right now I am trying to find where the issue lies with IIS. This code base deployed in two different virtual directories behaves differently. It works in one, but not the other. I do not think this is code. I think this is environmental.

  • Re: ASPX Default Buttons

    11 hours, 28 minutes ago|jeffrey.daro|LINK

    Thank you for taking time to respond, Mika. As I mentioned above. This code works fine in one subdomain, but not another and this ONLY affects the default.aspx page. Other pages work fine. I do not think this is code. This is something related to IIS.