clearing everything in the response and sending my own text

A

Abubakar

Hi,

there is a aspx page in my web application, in certain conditions, I don't
want its response to carry all the html that exists in the design view,
instead I want to response to contain *only* some short text that I want to
send down as response. The Response.Clear () is not doing this job. Plz
recommend a way.
Coding in visual studio 2k5/Win7rc.

thanks,

...ab
http://joehacker.blogspot.com
 
T

ThatsIT.net.au

I cant see how response clear is not doing its job, I mean is should.
When you say just test, do you mean you don't event want
<html><head><body>??
if so you should use a ashx page, a ashx page is much like a aspx page but
it is used for rendering other formats like jpg gif pdf doc xls, give it the
correct content type and it will render it, you don't need to response clear
because its just rendering what you want with out and html specific stuff
 
A

Abubakar

Hi,
I cant see how response clear is not doing its job, I mean is should.
When you say just test, do you mean you don't event want
<html><head><body>??

Yea, everything.
if so you should use a ashx page, a ashx page is much like a aspx page but

if I had an option of making a new page just for this purpose I would make a
new aspx page and remove all the design time html stuff and just code the
server side code behind stuff.
The thing is that I have a page which already is performing some nice
functionality, its got bound drop downs and a datalist control etc. I just
wanted to make a ajax call (XMLHttpRequest) from within that page and
request some functionality. Now I noticed that along the response that I
write through Response.Write(), a lot of html was also coming down the
wires, which ofcourse I can write a lil javascript code to get rid of, but
wont be satisfied with it. So just for the XMLHttpRequest call I was
thinking hey I should just get rid of all the html that's coming along, but
it didn't work.

I was searching google, but havnt found much, I think it cant be done (the
way I want)? I was hoping there should be just a simple event somewhere in
the life cycle of an aspx page which would just allow me to get rid of all
the response that has been contructed so far, or maybe, don't even do any
aspx side parsing :) and just leave everything in the response to me.

last choice would be to do some easy refactoring of the page1 and than
through the page2 (which I will make specifically for XMLHttpRequest) use
the data queries that I need from the refactored code.

thanks,
...ab
http://joehacker.blogspot.com
 
B

bruce barker

as you are probably using buffered responses, the clear has little
effect. you need to call Response.End() to prevent more text being
written. try:

Response.Clear();
Response.Wtite("only text");
Response.End();

-- bruce (sqlwork.com)
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top