newbie: what is postback for??

Discussion in 'ASP .Net' started by me, Feb 16, 2004.

  1. me

    me Guest

    Just starting to learn asp.net but i dont understand
    what postback is for. I have never in asp.old, php or perl
    etc. sent the user back to the same page when a submit button
    is clicked. Does asp.net insist on this in order to do
    automatic validation of inputfields, or is there some other
    explaination?? End result is that I always have to do
    Response.Redirect() after a submit, which seems clumsy. I am
    doing something wrong??
     
    me, Feb 16, 2004
    #1
    1. Advertising

  2. me

    Yuri Belenky Guest

    Generaly postback is the process of sending form back to the server, but
    actually postback is also the client-side script function which initialize
    sending web form to the web server. This function is embedded to the
    rendered HTML by ASP.NET Framework.
    ASP.NET framework allows developer to determ is the page requested for first
    time or this form processing is the result of postback

    "me" <> wrote in message
    news:...
    > Just starting to learn asp.net but i dont understand
    > what postback is for. I have never in asp.old, php or perl
    > etc. sent the user back to the same page when a submit button
    > is clicked. Does asp.net insist on this in order to do
    > automatic validation of inputfields, or is there some other
    > explaination?? End result is that I always have to do
    > Response.Redirect() after a submit, which seems clumsy. I am
    > doing something wrong??
     
    Yuri Belenky, Feb 16, 2004
    #2
    1. Advertising

  3. My own opinion, but I think it helps keep code more object-oriented to have
    a submit button postback to the same page. That way, you don't have two
    separate pages that handle the processing associated with a given form.

    For example, a login page:
    Old way is to have the username & password textboxes on one page, then the
    submit button sends to an authorize page that checks to see if it is legal
    username/password and does whatever else. In asp.net, all of that is
    handled in a single class / web page. It helps with validation, and from a
    developer's point of view, it keeps everything associated with login
    isolated to the one class/page. And then, you are correct, you would use a
    Response.Redirect() to send the user to either an "Access Denied" page or on
    to the rest of the site as an authenticated user. That's just one example.

    If you change the name of textboxes, or add other fields & controls, you
    (generally) only have to worry about changes within the same class - other
    web pages won't be affected.

    --
    Mike Mayer, C# MVP

    http://www.mag37.com/csharp/


    "me" <> wrote in message
    news:...
    > Just starting to learn asp.net but i dont understand
    > what postback is for. I have never in asp.old, php or perl
    > etc. sent the user back to the same page when a submit button
    > is clicked. Does asp.net insist on this in order to do
    > automatic validation of inputfields, or is there some other
    > explaination?? End result is that I always have to do
    > Response.Redirect() after a submit, which seems clumsy. I am
    > doing something wrong??
     
    Michael Mayer [C# MVP], Feb 16, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Psych971
    Replies:
    5
    Views:
    4,651
    bruce barker
    Dec 17, 2004
  2. =?Utf-8?B?Q2hhZA==?=

    Postback not being set to True on first postback

    =?Utf-8?B?Q2hhZA==?=, Apr 4, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    516
    =?Utf-8?B?Q2hhZA==?=
    Apr 4, 2005
  3. gce
    Replies:
    2
    Views:
    1,728
  4. Jacky Chau
    Replies:
    2
    Views:
    2,090
    Ninjamyst
    Jun 8, 2005
  5. Fabio Mastria
    Replies:
    5
    Views:
    4,382
    TechMCAD13
    Jan 30, 2008
Loading...

Share This Page