469,643 Members | 1,771 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,643 developers. It's quick & easy.

asp.net find Page Size

Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database

TIA
Nov 2 '07 #1
7 4453
On Nov 2, 12:31 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database

TIA
Well,

I never thought of that, but I believe you can override the OnRender
method of the page and after calling the base.OnRender method check
the Response.OutputStream.Length and that should have the size in
bytes of the whole stream sent to the client.

However it does not include any outside file, i.e. scripts referenced
by <script src="">, images, or anything but the HTML sent by the asp
page.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com

Nov 2 '07 #2
Thanks Paul can I also ask, as the approach I have just found was to set a
filter on the Response object, and then query the stream size there, do you
know if this has the external file content in? Thanks in advance..
protected void Application_BeginRequest(Object sender, EventArgs e)
{

Response.Filter = new GetSizeFilter(Response.Filter);
}

"PJ on Development" wrote:
On Nov 2, 12:31 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database

TIA

Well,

I never thought of that, but I believe you can override the OnRender
method of the page and after calling the base.OnRender method check
the Response.OutputStream.Length and that should have the size in
bytes of the whole stream sent to the client.

However it does not include any outside file, i.e. scripts referenced
by <script src="">, images, or anything but the HTML sent by the asp
page.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com

Nov 2 '07 #3
You can create your own filter and attach it to Response.Filter.
It will count bytes/characters outputted to browser

George
"Rob Thomson" <Ro********@discussions.microsoft.comwrote in message
news:E4**********************************@microsof t.com...
Hi is there a way in asp.net 1.1 to in code behind query the page size
that
is generated, I realise IIS does it as it has that data in the logs, I
would
like to capture this data so that I can create a log for performance on
our
site that is all held in the database

TIA

Nov 2 '07 #4
Paul, Ive tried your approach but am getting method not supported, is there
something I need to set on the response object to enable the length property,
I have checked I have an output stream....TIA

"PJ on Development" wrote:
On Nov 2, 12:31 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database

TIA

Well,

I never thought of that, but I believe you can override the OnRender
method of the page and after calling the base.OnRender method check
the Response.OutputStream.Length and that should have the size in
bytes of the whole stream sent to the client.

However it does not include any outside file, i.e. scripts referenced
by <script src="">, images, or anything but the HTML sent by the asp
page.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com

Nov 2 '07 #5
Unfortunally there is no way to get the size of external references
within tha page, because for each external reference the browser will
gnerate a new Request to download the required file.

Just out of curiosity, why do you need to know the size of the page
sent to the browser?

Anyway, like I said, I never tried to do such thing, and it seems that
the underlieing stream of the Response object does not allow seek,
which invalidade the Length property.

I've tried to create a custom filter to count the bytes sent to the
Response, but so far I was unsuccessful.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com

On Nov 2, 1:55 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Paul, Ive tried your approach but am getting method not supported, is there
something I need to set on the response object to enable the length property,
I have checked I have an output stream....TIA

"PJ on Development" wrote:
On Nov 2, 12:31 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database
TIA
Well,
I never thought of that, but I believe you can override the OnRender
method of the page and after calling the base.OnRender method check
the Response.OutputStream.Length and that should have the size in
bytes of the whole stream sent to the client.
However it does not include any outside file, i.e. scripts referenced
by <script src="">, images, or anything but the HTML sent by the asp
page.
Regards,
Paulo Santos
http://pjondevelopment.50webs.com- Hide quoted text -

- Show quoted text -

Nov 4 '07 #6
Thanks for your reply, the explanation on external references was useful

I want to get the size of the page so that I can put in logging information.
We have a badly performing application and the page size is dynamic, so when
I turn on logging I want to store this in a database for ease of querying and
to put the page size and querystring, so I can see whats going on

To get the custom filter working if you try this url the code there will work
http://www.codeproject.com/aspnet/WhitespaceFilter.asp

Regards

"PJ on Development" wrote:
Unfortunally there is no way to get the size of external references
within tha page, because for each external reference the browser will
gnerate a new Request to download the required file.

Just out of curiosity, why do you need to know the size of the page
sent to the browser?

Anyway, like I said, I never tried to do such thing, and it seems that
the underlieing stream of the Response object does not allow seek,
which invalidade the Length property.

I've tried to create a custom filter to count the bytes sent to the
Response, but so far I was unsuccessful.

Regards,

Paulo Santos
http://pjondevelopment.50webs.com

On Nov 2, 1:55 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Paul, Ive tried your approach but am getting method not supported, is there
something I need to set on the response object to enable the length property,
I have checked I have an output stream....TIA

"PJ on Development" wrote:
On Nov 2, 12:31 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database
TIA
Well,
I never thought of that, but I believe you can override the OnRender
method of the page and after calling the base.OnRender method check
the Response.OutputStream.Length and that should have the size in
bytes of the whole stream sent to the client.
However it does not include any outside file, i.e. scripts referenced
by <script src="">, images, or anything but the HTML sent by the asp
page.
Regards,
Paulo Santos
>http://pjondevelopment.50webs.com- Hide quoted text -
- Show quoted text -


Nov 5 '07 #7
Thanks for the article.

I'll look into it soon, and try to implement something that can
measure a page size on the fly.

The article will be useful, and what it implements could be useful for
me in some future projects. Of course, after a MAJOR overhaul on that
code. ;-)

Regards,

Paulo Santos
http://pjondevelopment.50webs.com

On Nov 5, 3:36 am, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Thanks for your reply, the explanation on external references was useful

I want to get the size of the page so that I can put in logging information.
We have a badly performing application and the page size is dynamic, so when
I turn on logging I want to store this in a database for ease of querying and
to put the page size and querystring, so I can see whats going on

To get the custom filter working if you try this url the code there will workhttp://www.codeproject.com/aspnet/WhitespaceFilter.asp

Regards

"PJ on Development" wrote:
Unfortunally there is no way to get the size of external references
within tha page, because for each external reference the browser will
gnerate a new Request to download the required file.
Just out of curiosity, why do you need to know the size of the page
sent to the browser?
Anyway, like I said, I never tried to do such thing, and it seems that
the underlieing stream of the Response object does not allow seek,
which invalidade the Length property.
I've tried to create a custom filter to count the bytes sent to the
Response, but so far I was unsuccessful.
Regards,
Paulo Santos
http://pjondevelopment.50webs.com
On Nov 2, 1:55 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Paul, Ive tried your approach but am getting method not supported, is there
something I need to set on the response object to enable the length property,
I have checked I have an output stream....TIA
"PJ on Development" wrote:
On Nov 2, 12:31 pm, Rob Thomson <RobThom...@discussions.microsoft.com>
wrote:
Hi is there a way in asp.net 1.1 to in code behind query the page size that
is generated, I realise IIS does it as it has that data in the logs, I would
like to capture this data so that I can create a log for performance on our
site that is all held in the database
TIA
Well,
I never thought of that, but I believe you can override the OnRender
method of the page and after calling the base.OnRender method check
the Response.OutputStream.Length and that should have the size in
bytes of the whole stream sent to the client.
However it does not include any outside file, i.e. scripts referenced
by <script src="">, images, or anything but the HTML sent by the asp
page.
Regards,
Paulo Santos
http://pjondevelopment.50webs.com-Hide quoted text -
- Show quoted text -- Hide quoted text -

- Show quoted text -

Nov 7 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bob Stearns | last post: by
27 posts views Thread by one man army | last post: by
5 posts views Thread by YaoBao | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.