How to improve ASP.NET web application performance? - asp.net

To be more specific... When someone clicks a link on my web application, can that user be redirected immediately after the click and then wait for the page (user controls) to load. (Can the user controls load one by one with a priority or something?)
Right know, there is a delay after the user clicks on a link and then gets redirected.

Things you can do:
Check how you're using the ViewState if you're not careful it gets
quite big. But some parts of your app might be depending on it so
it's kind of situational.
Caching of pages or just controls
AJAX - while it doesn't feel as natural as in the MVC, it's still an option
for Web Forms
Script & Css bundling and minification - less requests
for more data are always faster then more requests for less data
These are things I'd start with. From my experience excesive ViewState is the place where you can gain the most but a usually it takes quite some effort to get rid of it since just turning it off might make some of your controls not working properly on postback.
This is just a start but going deeper would require much deeper knowladge of the application.

You could use AJAX technology to create the required responsiveness of your application.
In fact, you only need one page. You could load all actions performed (and the updated HTML/JS) using AJAX.
I would advise to read into that subject. You could use jQuery or similar frameworks to do the communication with the web server.
Required reading: ASP.NET AJAX.

My advice is to try to redo your application with AJAX approach:
here is a smart article about it http://www.asp.net/mvc/overview/older-versions-1/nerddinner/use-ajax-to-deliver-dynamic-updates
Take a look to AJAX technique: http://en.wikipedia.org/wiki/Ajax_(programming)

From what I understand, you are using classic Asp.NET and therefore, webforms.
One way to speed things would be to switch to the Razor platform, which eases things a bit (by preventing unnecessary postbacks).
Alternatively, if you don't want to remake the whole application, you could use a simple html link instead of an asp:hyperlink.

Related

call ajax and asp callbacks through proxy

I have two parts of my ASP site,
and i'm trying to view one site in the other, using proxy.
i'm doing it through IHttpHandler.
The site is looking good through the proxy, but i can't call AJAX, either use ASP callbacks (in my case a telerik grid).
any help would be appreciated.
Telerik controls (Like other MS AJAX based toolsets) utilize WebResources heavily. Make sure your proxy is transparent for them as well (e.g., either does not route them at all, or that they return succesfully, even though I do not know how one app could server another's webresource request).
Consider just framing those pages (e.g., in RadWindows, RadPanes inside a RadSplitter, simple iframes, whatever fits your design).
You can also try using the CDNs Telerik offers in addition to the MS AJAX CDN,so that less webresoures are being used.

How to improve Performance in ASP.net application

We have migrated one classic ASP application to ASP.net2010 using C#.
Compare to the classic ASP application the newly migrated application's performance is bit slow.
Which areas need to be checked to improve performance?
Disable viewstate on pages and or controls that don't need it and follow all the advice given here: ASP.NET: how to load page faster
Run a profiler on it. I use JetBrain's. It will pin point the places in code that are the slowest.
Check your data access. In conversions like this, I've seen that as the major area of issue.
Page.IsPostBack Property
Enable Buffering
Remove unused HttpModules
Trim Page Sizes
Use a CDN
Server.Transfer and Response.Redirect
Precompiling
Session State Management
ViewState
Caching
Locking and Shared Resources
this post explains a 20 tips to improve asp.net performance
mainly you will find tips like reduce usage of sessions and ViewState.. keep page size small
don't include any css styles or javascripts in the page markup.
please go through below links. And implement based on your need.
http://wiki.asp.net/page.aspx/667/improve-perfomance-in-aspnet/
http://madskristensen.net/post/A-whitespace-removal-HTTP-module-for-ASPNET-20.aspx
http://madskristensen.net/post/HTTP-compression-in-ASPNET-20.aspx
http://weblogs.asp.net/owscott/archive/2004/01/12/IIS-Compression-in-IIS6.0.aspx
http://it.megocollector.com/?p=1258http://weblogs.asp.net/lkempe/archive/2010/01/03/optimization-of-web-site-hosted-on-iis-6.aspx
http://developer.yahoo.com/performance/rules.html
http://omaralzabir.com/best_practices_for_creating_websites_in_iis_6_0/
http://www.c-sharpcorner.com/uploadfile/shivprasadk/net-best-practice-no-1-detecting-high-memory-consuming-functions-in-net-code/

problem in load dynamic webpage (I want to indicate which part of my page load first in classic asp and also asp.net)

we are creating a custom content management and out portal page is bit bulky it is about 60Kb without images.
and during loading the page in some browser we can see some parts of site load faster than the other parts of the site where as we want to indicate (or instruct the web server) to load some of the areas first then load rest of the page.
is there any particulat setting in IIS for is there any particular method in classic asp for doing that?
also I have the same question in asp.net.
best regards.
I don't believe there is a built in way to describe which parts of a page load first in either ASP or ASP.Net. It really isn't a server decision - depends on how your browser parses the page and then requests the additional resources (or renders the existing ones).
You could potentially use AJAX and build in the order each section loads either as a state engine or by chaining. Seems to be pretty complicated for the benefit.
If you just don't want the user to see anything until the entire page loads you can control that from code using buffering. In classic ASP you use Response.Buffer and Response.Flush so the server doesn't start returning HTML until the whole page is ready - it will keep parts of the page from loading (the server won't stream results). I assume ASP.Net has a similar/identical method for buffering. Note that you can't pick sections of code with buffering but you can send only portions (top down) at a time.

How are .ascx files cached?

I have an asp.net project, and I load a base aspx page to display to the user. Then I ajax in the results of an ascx component and inject it via innerHTML in javascript.
I have noticed that the ascx component loads slowly on the first page load, but instantly thereafter. This is really cool, but I do not understand how this can be cached, as the contents are generated by making several db calls.
Does the server send some kind of hash to compare the contents to, to see if it changed on the server or not? Is this a browser thing or an asp.net thing?
What you are experiencing is most likely just in time compiling and has very little to do with the user control itself.
Watch the performance monitor counters for .net. This will tell you a lot about what's going on.
Can you use Firebug/IE developer console/etc. to determine the response code? If you can check the headers, you should be able to see a date that indicates either a cache time or a last modified date. I poked through the MS ASP.NET Ajax documentation, but couldn't find any references to default caching times or cache modification.
However, jQuery's ajax function uses an ifModified property which (according to the documentation) checks the Last-Modified header to determine whether or not it should retrieve the results. I'd imagine that the ASP.NET Ajax calls work in a similar fashion. It may not be prudent for your current project, but jQuery makes it very easy to set caching options.

Can someone give me an overview of ASP.net and how it's different from technologies such as php?

I've been doing the html and css for a site, sending it off to a guy to implement in a web server. I get a call from the designer freaking out about the progress, saying the clients aren't happy. He wants me to personally integrate my css with what's on the site. The site is done in ASP.net, time is short, and I'm a little in over my head. I have an understanding of how php works, but have never worked extensively with it.
Looking at the stuff on the ftp, I can't even find equivalent of the index.html file (I know that when I go to the site itself, there is nothing after the base url, i.e., www.site.com/ brings me to the homepage.)
Can anyone give me a few tips or links as to what I am to do with this, or where to even being navigating this site?
EDIT: It's -not- a .Net Web Application, from the looks of it.
ASP.Net can be run in a compiled or a scripted environment. It is important to understand which environment your client has. If it is completely scripted, then you are likely looking for the default.aspx file and it's contents. If it is a compiled environment, you may be in for a ride. A compiled site may incorporate "master pages" as a templating engine, and then you'll need to apply your html/css modifications in several places.
You should start with the default.aspx page if there is one. Look for master page directives (it'll be named something like masterpage.master). If there isn't one, then you're in luck you'll just need to implement your changes on a page by page basis. The aspx page will be in a templated xml format so avoid touching tags that involve touching
If you are making changes to divs and structures of that nature, you may need to modify the CssClass attribute of the controls. I would recommend however that you make a back up, give it a shot, and under no circumstances attempt to do something that you aren't really ready to do. You will only anger the client and ruin your rep. It may actually be prudent to contact an actual ASP.Net developer to analyze the files separately and determine what you need to do.
I suggest that you read the Wikipedia article about ASP.NET to get familiarized with it as it summarizes the basic building structures.
Then, just to get you started: take a look at the more recent ASP.NET MVC (Model-View-Controller) paradigm. There's also development in what is called ASP.NET WebForms.
For example: when you go to www.site.com/ (known as friendly URLs) it may be redirecting you to an action method inside a controller. It's called routing. There's also URL rewrite.
In the MVC world a Controller can send/redirect the user to a specific View/Page.
A View (.aspx form/page) that contais HTML markup and CSS on the server side is basically an HTML page (.htm) page that'll be rendered on the client side.

Resources