Re: How to write a GUI-less page

Discussion in 'ASP .Net' started by Giscard, Aug 22, 2003.

  1. Giscard

    Giscard Guest

    "Alek Davis" <alek_DOT_davis_AT_intel_DOT_com> wrote in message news:<>...
    > Hi,
    >
    > I need to implement a health check page as part of a Web site. This page is
    > supposed to be invoked programmatically from a script and it does not need
    > any GUI. When the script attempts to access the page, it is supposed to
    > query the HTTP status code (e.g. 200, 500, etc), to determine whether the
    > operation was successful or not. So how can I programmatically make the ASPX
    > return a status code without generating any HTML output? I tried this:
    >
    > (1) Set EnableViewState="false" EnableViewStateMac="false" in the @Page
    > directive of the ASPX
    > (2) Set Response.StatusCode to the appropriate status code, e.g. 500 in the
    > Page_Load, followed by Response.End.
    >
    > This seems to work on one system (VS.NET 2002 used to build the project +
    > VS.NET 2003 also installed + CLR 1.0 + CLR 1.1), i.e. when an error status
    > code is returned, it is shown in the IE window. When I attempt to do the
    > same on another system (VS.NET 2002 + CLR 1.0), errors are never generated,
    > i.e. the browser always displays a blank page irrespective of the returned
    > status code.
    >
    > Am I not doing this correctly? Is there a better way of accomplishing the
    > same?
    >
    > Thanks,
    >
    > Alek


    For a lightweight solution. Make a class that implements the
    IHttpHandler interface and then add your handler to your web.config
    file.
    Giscard, Aug 22, 2003
    #1
    1. Advertising

  2. Giscard

    Alek Davis Guest

    Thanks Giscard,

    This may be a good idea. The only problem is that it will somewhat
    complicate administration. I have not worked with IHttpHandler-derived
    classes, so I may not be correct here, but I think that registering a new
    handler requires a change in a Web config as well as a modification of IIS
    application configuration (in IIS admin tool). It would be much easier if I
    could just simply do it in an ASPX (or code-behind) page. But I will look
    more closely into this.

    Alek

    "Giscard" <> wrote in message
    news:...
    > "Alek Davis" <alek_DOT_davis_AT_intel_DOT_com> wrote in message

    news:<>...
    > > Hi,
    > >
    > > I need to implement a health check page as part of a Web site. This page

    is
    > > supposed to be invoked programmatically from a script and it does not

    need
    > > any GUI. When the script attempts to access the page, it is supposed to
    > > query the HTTP status code (e.g. 200, 500, etc), to determine whether

    the
    > > operation was successful or not. So how can I programmatically make the

    ASPX
    > > return a status code without generating any HTML output? I tried this:
    > >
    > > (1) Set EnableViewState="false" EnableViewStateMac="false" in the @Page
    > > directive of the ASPX
    > > (2) Set Response.StatusCode to the appropriate status code, e.g. 500 in

    the
    > > Page_Load, followed by Response.End.
    > >
    > > This seems to work on one system (VS.NET 2002 used to build the project

    +
    > > VS.NET 2003 also installed + CLR 1.0 + CLR 1.1), i.e. when an error

    status
    > > code is returned, it is shown in the IE window. When I attempt to do the
    > > same on another system (VS.NET 2002 + CLR 1.0), errors are never

    generated,
    > > i.e. the browser always displays a blank page irrespective of the

    returned
    > > status code.
    > >
    > > Am I not doing this correctly? Is there a better way of accomplishing

    the
    > > same?
    > >
    > > Thanks,
    > >
    > > Alek

    >
    > For a lightweight solution. Make a class that implements the
    > IHttpHandler interface and then add your handler to your web.config
    > file.
    Alek Davis, Aug 22, 2003
    #2
    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. Chris Jackson

    Re: How to write a GUI-less page

    Chris Jackson, Aug 21, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    386
    Alek Davis
    Aug 21, 2003
  2. Jerry III

    Re: How to write a GUI-less page

    Jerry III, Aug 22, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    404
    Jerry III
    Aug 22, 2003
  3. jiajia wu
    Replies:
    0
    Views:
    340
    jiajia wu
    Oct 1, 2009
  4. 6668
    Replies:
    0
    Views:
    135
  5. lllll
    Replies:
    0
    Views:
    116
    lllll
    Jun 8, 2009
Loading...

Share This Page