How do you create a response page with no HTML in ASP.Net?

Discussion in 'ASP .Net' started by wptpro@gmail.com, Nov 17, 2005.

  1. Guest

    I need to create an aspx page that returns a data string with no html
    code. In ASP it would be easy by not including any HTML code and then
    doing a repsonse.write "my data string". How do i do this in .net? It
    seems to always include html even if I remove it from teh code behind
    page.
     
    , Nov 17, 2005
    #1
    1. Advertising

  2. Try in page_load or so:

    Response.clear
    Response.clearHeaders
    Response.clearContent

    Response.Write( "sgefddfdg" )

    Response.close
    Response.End


    <> schreef in bericht
    news:...
    >I need to create an aspx page that returns a data string with no html
    > code. In ASP it would be easy by not including any HTML code and then
    > doing a repsonse.write "my data string". How do i do this in .net? It
    > seems to always include html even if I remove it from teh code behind
    > page.
    >
     
    Edwin Knoppert, Nov 17, 2005
    #2
    1. Advertising

  3. Joerg Jooss Guest

    Edwin Knoppert wrote:

    > Try in page_load or so:
    >
    > Response.clear
    > Response.clearHeaders
    > Response.clearContent
    >
    > Response.Write( "sgefddfdg" )
    >
    > Response.close
    > Response.End


    A HttpHandler would be a cleaner solution if all you want to do is dump
    raw data back to the client.

    Cheers,
    --
    http://www.joergjooss.de
    mailto:
     
    Joerg Jooss, Nov 17, 2005
    #3
  4. Guest

    any tips or help on how to do that would be great. I couldt ge the
    example above to work. I just need to call an aspx page, do some
    program logic, then return a data string. I'm replacing an http post
    to a cgi app.
     
    , Nov 17, 2005
    #4
  5. If you remove all the template code, leaving a blank template, and
    Response.Write anything that is not HTML, there will be no HTML in the
    Response.

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    If you push something hard enough,
    it will fall over.
    - Fudd's First Law of Opposition

    <> wrote in message
    news:...
    >I need to create an aspx page that returns a data string with no html
    > code. In ASP it would be easy by not including any HTML code and then
    > doing a repsonse.write "my data string". How do i do this in .net? It
    > seems to always include html even if I remove it from teh code behind
    > page.
    >
     
    Kevin Spencer, Nov 18, 2005
    #5
  6. Joerg Jooss Guest

    wrote:

    > any tips or help on how to do that would be great. I couldt ge the
    > example above to work. I just need to call an aspx page, do some
    > program logic, then return a data string. I'm replacing an http post
    > to a cgi app.


    See
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide
    /html/cpconcreatinghttphandlers.asp for an introduction to HttpHandlers.

    As other users pointed out, you can use a ASP.NET page as well, but you
    need to make sure that it doesn't contain any markup and you pay the
    overhead of the page lifecycle at runtime.

    Cheers,
    --
    http://www.joergjooss.de
    mailto:
     
    Joerg Jooss, Nov 18, 2005
    #6
    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. Mark Kamoski
    Replies:
    1
    Views:
    7,177
  2. TinyTim
    Replies:
    2
    Views:
    426
    TinyTim
    Aug 10, 2004
  3. André
    Replies:
    3
    Views:
    1,941
    André
    Dec 1, 2006
  4. Chuck
    Replies:
    0
    Views:
    282
    Chuck
    Jul 5, 2003
  5. Jake Barnes
    Replies:
    15
    Views:
    194
    Thomas 'PointedEars' Lahn
    Feb 7, 2006
Loading...

Share This Page