Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9297179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T22:00:22+00:00 2026-06-18T22:00:22+00:00

I’m a very new ASP.NET developer (and web developer at all for that matter.)

  • 0

I’m a very new ASP.NET developer (and web developer at all for that matter.) I want to put together a simple website that has the web server providing a form containing a few controls for setting a timer, and a start button, which when pressed, posts the configuration to the server (for how long the timer is set for.) and also starts the timer in the client, upon expiration, it would also post to the server that this has been done.

If this is easy please explain to me how to go about doing something like this, if this is not easy, or even more so if this is “not a good way to go about this” please explain to me a better architecture or design for this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T22:00:23+00:00Added an answer on June 18, 2026 at 10:00 pm

    As this is a client-side thing, I wouldn’t use ASP.NET 🙂 Obviously it still stands for the server-side, anyway:

    1. New ASP.NET MVC project with a single controller, two views, and two corresponding viewmodels.
    2. View has a <form> with the timer <select> or text-box or something.
    3. Controller has an action that receives the POSTed form data and saves it or something, then returns a 303 response to a view that has a hidden field that specifies when the timer should end, this value should be persisted on the server in Session state in case the user refreshes the page. The value should be saved as an absolute UTC date-time value.
    4. The client has a simple client-script that, on page-load, inspects this hidden fields and sets up the timer using setTimeout.
    5. The script also contains a callback function that will be called when the timer reaches its end. This callback function will create and populate a hidden dynamic <form> element which is submitted, causing a POST request to the server with some tag that identifies the client and timer that expired. The server then does another 303 redirect back to the original view, possibly containing a message for the user or something.

    This is probably the simplist way using modern techniques and avoiding complexities inherent in using AJAX or external frameworks like jQuery or Mootools. Note my use of 303 redirect instead of returning a HTML repsonse to a POST request – this is for the user’s benefit so they never get the browser “Resubmit form?” dialog and also prevents the timer from being reset.

    UPDATE:

    Why 3xx Responses Are Good:

    When a client submits a POST request, the webserver can respond either by returning a response directly, or by doing a 3xx redirect to another page. The problem with providing a response directly is that the content of the response (i.e. the web page) is not “accessible” as far as HTTP is concerned: you cannot retrieve the same content with a GET request. This is why when a user presses F5 or hits Refresh for a POST’d page they get a message-box prompting them (in cryptic language) to resubmit the form, however often if the user resubmits the form they’ll end up breaking the application because their data will be processed twice. This is why ASP.NET WebForms, which its heavy reliance on “postback” is being phased out.

    Javascript

    The code would look something like this:

    // bind to this event rather than executing directly because the onload event is only fired after the entire DOM is available. If you run the code immediately then you won't be able to traverse the DOM tree.
    window.onload = setUpCallback;
    
    function setUpCallback() {
        var hiddenField = document.getElementByID("someHiddenFieldId");
        var timeStampEnd = parseInt( hiddenField.value ); // this is the number of miliseconds since 1970-Jan-01 00:00
        var timeStampNow = new Date().getTime(); // this also returns a miliseconds-since-1970 value
    
        var timeToEnd = timeStampEnd - timeStampNow;
        if( timeToEnd > 0 ) {
            window.setTimeout( onTimerEnd, timeToEnd ); // set-up the callback
        }
    }
    
    function onTimerEnd() {
        var form = document.createElement("form");
        form.action = "http://mywebsite/uriToSubmitPostTo";
        form.method = "post";
        document.documentElement.appendChild( form );
    
        var clientField = document.createElement("input");
        clientField.type = "hidden";
        clientField.name = "someFieldName";
        clientField.value = "someValueToIdentifyTheClientOrJustUseSession?";
    
        form.appendChild( clientField );
    
        form.submit();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm interested in microtypography issues on the web. I want a tool to fix:
I am doing a simple coin flipping experiment for class that involves flipping a
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Let's say I'm outputting a post title and in our database, it's Hello Y&#8217;all
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.