Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Thursday, March 29, 2012

Performance on images.

I have a web application which contains loads of images.

when I load from our hosted site, its pretty slow. i can see every image as they were loading. sometimes images do not display until they are used ( e.g. mouseover a certain image panel )

Question is. what is the best practice of handling images to boost performance? currently i just place my images in a folder and use CSS to reference them.

Will it improve performance to use Resource files instead?

thanks!

the only way i can think of is to cache the page, but the first still needs time as physically, people have to download the images no matter what.

Hi,

The way u r doing is common thing and i think its the right way also.
this problem may be becasuse of poor bandwidth. Anyway it will be better to use image will less KB's


thank you for your inputs. one thing more is that I heavily use server controls, which I'm not really sure if it has any effect on performance... taking out the ViewState factor...

I just have one thing to consider, if you are dealing with large images you can create thumbnails out of these images which will decrease its size and increase the loading speed.

Create Thumbnail Images

HC


can you elaborate on what you mean please??

do you mean to use the code your probided in ur blog to create thumbnail images.. and use these images instead?


The code provided will create a thumbnail image from the original image with specified width and height (100 px, 100px) which will decrease its size and make the load process better. for example if you have an image size equals to 6 mb when you create a thumbnail it will be 24 kb or even less.

So what yo u can do is to programatically using the provided code create an thumbnails save them in a folder on your web server and load them instead of using the original images.

HC


hi,

i've read your problem thru. and i think both the above two solutions can solve you problem. you can use output caching in ur page,setting theDuration time a little ralatively longer andLoctaionto be 'Any'. For more information you can refer to:

ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_aspnetcon/html/51149563-a347-4b2b-bdc2-57a317e12487.htm

Also you can follow haissam's suggestion to create thumbnail images for the original ones.

Well, i have another suggestion, you can choose to host your images to another web host( if you have got pretty pretty lots of images) which is much more powerful and stronger . This can make your access to the images much faster than now.

Hope my suggestion helps. :)


I appreciate all your responses. thank you very much.! =)

hi,

how do i open this link ? ms-help://MS.MSDNQTR.v80.en/MS.MSDN.v80/MS.VisualStudio.v80.en/dv_aspnetcon/html/51149563-a347-4b2b-bdc2-57a317e12487.htm


The 100 px x 100px.. is that fixed? or just need to set it same with the original height and oeiginal width?

so if you have an image 1000px by 400px... just set it to these values?


another thing, i'm getting "A generic error occurred in GDI+" error when saving the thumbnail. any ideaS?

oh, i assumed that u have an msdn installed on your local computer. i'm sorry. you can still refer to :http://msdn2.microsoft.com/en-us/library/zd1ysf1y(VS.80).aspx

it's the same :)

Monday, March 26, 2012

Performance Tracking

Hi,

Im using a 3-tier architecture.. 1.Presentation Layer. 2.Web Serice 3.Business Logic Layer(includes DAL).

The presentation layer mostly contains datagrids and repeaters. It makes call to the webservice and get data...The webservice inturn calls the appropriate Business layer function which inturn gets the datat from db.

Now i want to monitor the time taken by each layer to execute and produce the result to the upper layer. How to do that? Is there any .NET provision for this?

Further what are all the other ways to track the performance?

You can enable Trace="true" for the page. And you can see the time taken in each steps.
http://msdn2.microsoft.com/en-us/library/system.diagnostics.trace.aspx

Performing a download along with another action

I have a webform that contains a button which I want to do three things:

1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted

I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:

Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()

If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/when the browser requests a page (like when the user hit the button), the
browser only expects one document back. you can do one of several options

1) refesh page and enable a download button
2) refresh page and use client script to start a download
3) refresh page and use meta tag to start download

in all cases you refresh the page and then download the text file.

-- bruce (sqlwork.com)

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
This can be done. What is meant by refreshing the page, something like
re-display the grid?
So the user hits the button:
1. You delete the record and re-bind the grid so the user can see the
changes on this page.
2. You save the text to be downloaded in a session variable - this is the
simplest, or on disk, or database record, etc.
3. You have a Protected string variable, say MustDownLoad, and set it's
value "Yes", or anything, to be read by Java script.
4. In the HTML view of the form, right at the bottom, you must add Java
script to open a new window to download the text:
<script language="javascript">
if ("<%=MustDownLoad%>" != "") {
window.open("Form_DownLoadText.aspx");
}
</script>
5. You create a new form Form_DownLoadText.aspx and in it, you read the text
from the session variable/disk/record and do the
Response.ClearContent()
Response.ContentType = "text/plain"
yada yada

"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
Nathan,

Maybe a stupid question, why do you not use the HTML command File Field. It
is a strange name because AFAIK mostly is used Download Button.

It is the HTML tag <Input type=file
Cor

Performing a download along with another action

I have a webform that contains a button which I want to do three things:
1. Delete a record from a database
2. Let the user download a text file that is generated
3. Refresh the page to show that the record was deleted
I am able to do any of these things separately with no trouble. The problem
occurs when I try to offer a download AND call my refresh method. When I try
to do a download and call my refresh method, only the download is performed,
regardless of whether the refresh is called before or after the download.
Here is snippet of my code that does the download and refresh:
Me.RefreshEvents()
Response.ClearContent()
Response.ContentType = "text/plain"
Response.AddHeader("content-disposition", "attachment;filename=" &
downloadname)
Response.Write(downloadtext)
Response.End()
If I comment out five lines that do the download, Me.RefreshEvents() does
what I want and would expect, but otherwise it appears to do nothing. I
don't care whether Me.RefreshEvents() is called before or after doing the
download, as long as they are both done. What can I do to make sure both of
these tasks get completed?
--
Nathan Sokalski
njsokalski@dotnet.itags.org.hotmail.com
http://www.nathansokalski.com/when the browser requests a page (like when the user hit the button), the
browser only expects one document back. you can do one of several options
1) refesh page and enable a download button
2) refresh page and use client script to start a download
3) refresh page and use meta tag to start download
in all cases you refresh the page and then download the text file.
-- bruce (sqlwork.com)
"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
This can be done. What is meant by refreshing the page, something like
re-display the grid?
So the user hits the button:
1. You delete the record and re-bind the grid so the user can see the
changes on this page.
2. You save the text to be downloaded in a session variable - this is the
simplest, or on disk, or database record, etc.
3. You have a Protected string variable, say MustDownLoad, and set it's
value "Yes", or anything, to be read by Java script.
4. In the HTML view of the form, right at the bottom, you must add Java
script to open a new window to download the text:
<script language="javascript">
if ("<%=MustDownLoad%>" != "") {
window.open("Form_DownLoadText.aspx");
}
</script>
5. You create a new form Form_DownLoadText.aspx and in it, you read the text
from the session variable/disk/record and do the
Response.ClearContent()
Response.ContentType = "text/plain"
yada yada
"Nathan Sokalski" <njsokalski@.hotmail.com> wrote in message
news:OluwItk6FHA.2176@.TK2MSFTNGP14.phx.gbl...
>I have a webform that contains a button which I want to do three things:
> 1. Delete a record from a database
> 2. Let the user download a text file that is generated
> 3. Refresh the page to show that the record was deleted
> I am able to do any of these things separately with no trouble. The
> problem occurs when I try to offer a download AND call my refresh method.
> When I try to do a download and call my refresh method, only the download
> is performed, regardless of whether the refresh is called before or after
> the download. Here is snippet of my code that does the download and
> refresh:
>
> Me.RefreshEvents()
> Response.ClearContent()
> Response.ContentType = "text/plain"
> Response.AddHeader("content-disposition", "attachment;filename=" &
> downloadname)
> Response.Write(downloadtext)
> Response.End()
>
> If I comment out five lines that do the download, Me.RefreshEvents() does
> what I want and would expect, but otherwise it appears to do nothing. I
> don't care whether Me.RefreshEvents() is called before or after doing the
> download, as long as they are both done. What can I do to make sure both
> of these tasks get completed?
> --
> Nathan Sokalski
> njsokalski@.hotmail.com
> http://www.nathansokalski.com/
>
Nathan,
Maybe a stupid question, why do you not use the HTML command File Field. It
is a strange name because AFAIK mostly is used Download Button.
It is the HTML tag <Input type=file>
Cor