Does anyone know much about the Asp.Net webconfig element ?
I'm looking at it because I'm implementing an MS Ajax updatepanel in an existing site,
and after doing some looking around, on the web I'm not finding a lot of info about it.
And to avoid the flood of replies telling me how inefficient the update panel is, and that it's not actually providing any benefit etc. etc. I know! Let's say I've got my reasons for using it and leave it at that.
I guess my main question is;, will setting enableCompression="true" and enableCaching="true" help the performace of my update panel in any way?
Given the traversing of the DOM that is actually happening with an update panel it's generally not the content that is hindering performance.. it is the PC/Browser.
I know this is exactly what you aren't looking for but unless your panel contains a significant amount of data then compression and caching isn't going to help you terribly.
I took this from the scriptresourcehandler documentation:
By default, the ScriptResourceHandler class compresses and caches embedded script files for Internet Explorer 7.
So I don't think you'll see any difference if you set enableCompression/enableCaching true because it's already happening if you're using IE7.
Related
Especially Ctrl+I , which is "mail this page". I'm using wordpress self hosted. So far I've found this code, not sure how to implement it or if it's old.
Please no plethora of reasons as to why you find this attempt pointless.
Really, shouldn't answer, but:
There's no reason for this, because there's always a very easy way around it. It'll probably take a lot more work than whatever you end up with's worth. If somebody has half of a computer literate mind, they probably can get past this without a problem at all.
Summary:
Don't bother
Disabling hotkeys won't stop anyone from just selecting that option from the File menu.
People will always find ways around these kinds of hacks. Turning off JavaScript, hacking the source with Firebug, Option+Click on a Mac, taking a screenshot, etc. They are completely ineffective against anyone even slightly determined to do what you don't want them to do.
You can't really do that. See this page for really good information on the portability of various key events in JavaScript across multiple browsers. You will see for one that each browser handles/responds to various key events in many different ways.
Also, most of the default browser actions (e.g. Ctrl-F, Ctrl-S) cannot be canceled if you are capturing key events. You can still detect some of them and respond, but you can't actually stop the browser from displaying the search dialog or whatever specific action is to be performed by the key combination.
Also, if someone really wants to take your page's HTML/JavaScript code or content, these methods won't stop them. The disable right click code from the link you referenced can prevent right click, but all someone has to do is disable javascript and it no longer works.
I am new to asp.net and have got some concerns about the bloated viewstate on a small site I'll be maintaining.
Since I actually don't want to learn asp.net (mvc looks interesting though), my question is if I should care about this potential issue or just wait 4 years until its time to rewrite the site....
Hopefully some of you have some experience or already have done a proper research to help me decide if it's worth the time to do something about it.
I am not interested in workarounds since if this is a serious issue I have found info about different ways to reduce the viewstate. (Although it requires me to understand the framework and code.)
Thanks.
some search engines only process the first few KBs of the page if the page size is large. As viewstate is a hidden input at the top of the form/page this can impact SEO as the actual content of the page may not get fully processed by the search engine if there is too much viewstate. Look into moving the viewstate to the bottom of the page.
http://www.hanselman.com/blog/MovingViewStateToTheBottomOfThePage.aspx
It can cause excessive page weight but this will not hurt your standing with the search engines. ViewState is stored in a hidden input which are mainly ignored by search engines.
I know this thread is old but in ASP.Net every control including the page itself has a property called EnableViewState. All one has to do is turn it to false if they do not need a control to maintain state or for that matter the page itself
This sounds like a "why would you do that?" sort of question, but here goes..
I have a very simple ASP.NET page which simply renders out a one column grid of about 10 rows with paging.
At the moment, I need (due to some technical restrictions) to essentially host the ASP.NET page within an IFRAME on a basic HTML page. It works of course, although I wonder if there is a better way?
For some reason I am thinking something like silverlight (which I might end up using) being a container.. or some other ActiveX type control..
Hope this explains enough?
Thanks in advance!
You're right, this is pretty much a "why would you do that" type of thing. However, we all know that you don't always have control over what you would like to do thanks to managers who don't know jack about developing websites, etc :) as I've been in a similar position and been forced to do almost exactly the same thing.
Anyways, I believe the way you are doing it is about the simplest way to do it. The only thing you might want to keep an eye on (I don't know if you are running from separate domains, as the question doesn't specify) is cross-domain scripting. For example, if your ASP.NET page is at www.myaspdomain.com and your HTML page is at www.myhtmldomain.com, cross-domain scripting, or scripting between the IFRAME and the ASP.NET page can cause some interesting bugs (features?) because of the security holes that such scripting opens up and has thus mostly been blocked nowadays.
You might be able to use XmlHttpRequest to fetch the contents on ASP.NET page to an HTML element.
I am using ASP.NET ajax to dynamically add/remove controls from a page without using full postbacks. The UI is very complicated. Under certain scenarios, when a control on the page causes a full postback, after changing the controls via async postbacks, I get this error:
Invalid postback or callback argument. Event validation is enabled using '<pages enableEventValidation="true"/>'
I can fix it by setting EnableEventValidation="false" at the page level.
What are the implications of doing this? Are there times when it is ok to do this or is this a hack?
If you have a WYSIWYG input text box or a textbox expecting HTML, then you have to disable validation or do some JavaScript hack.
The catch is that you will need to provide thorough validation to prevent XSS and such.
I would definitely say that it is a hack.
As far as reducing code complexity, have you tried inheriting from some of the controls and putting a lot of your code behind them? This definitely sounds like a case for refactoring!
It specifically says on their database tutorial that, currently you have to disable EventValidation. It is a bug.
http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Walkthrough/CCDWithDB.aspx
It may not directly answer your question, or seem relevant...
However, if your UI is very complicated, there's probably something wrong with it. Following KISS is a good idea for obvious reasons.
If your UI is complicated, then the chances are you don't understand it, so you'll get more problems, alot of which you may never notice. Your problems and bugs won't be easy to trace or figure out, and are likely to be obscure and removed from the actual cause of the problem.
Secondly, if it's complicated for you, and you wrote it, it's probably incomprehensible for anyone using it. Even if you're just meaning managing the code, the complexity is probably reflected in the presentation.
I suggest you take a look at redesigning the UI so that it isn't so complicated. It will always be better if you look at it again anyway, one doesn't usually have a good solution until the 3rd or 4th attempt at solving the problem.
When designing a ASP.net WebForm application what are some important steps to take (or hacks if you like to use the term) to ensure the best possible performance (in terms of speed, stability, and scalability)?
Here's a good Best Practices written by microsoft. Chapter 6 is specific to ASP.NET, but the whole document is .NET in general.
http://msdn.microsoft.com/en-us/library/ms998530.aspx
You've got a ton of material, directly from Microsoft here.
Also a checklist is available if you want condensed information.
Just a couple, in addition to the good advice already given,
Don't put every single page in a webform, not everything needs it - The default behaviour from VS is to give you a master page that wraps a form around everything, and a lot of people seem to stick with that. In my experience, some controls can render 30% faster outside of a webform, so if you're just parsing a querystring then reading something from a database, leave the form at home if you can. Even getting your navigation out of the form will help.
Don't use a server control when plain old HTML will do - does it really require a asp:linkbutton or asp:hyperlink just to go to the FAQ page etc. Plain hyperlinks work just fine in asp.net, but some people seem to get stuck on the idea of using runat="server" for everything.
There is a phenominal book on this subject by one of the Yahoo guys, Steve Souders. It taught me a lot.
Or you can just watch this video. It's a high level overview of the same information - you can pick up a lot in 45 minutes by watching this.
NOTE: This content is not WebForms-specific. It's general best practices for the web, and it is what you need if you are trying to roll out a high performance website.
Big # 1 tip: turn off viewstate in the web.config. That should have been the default, if you need it for a control turn it on on a control by control basis.
My other piece of advice is stay the hell away from *view controls. Use repeaters and find a good 3rd party grid control. The really "magical" controls that ship with asp tend to be perf hogs, and in general just not a good idea anyways (with the possible exception of ListView)
1 - Turn on content compression on iis
2 - Cache everything you can
This will do for the majority of webapps out there.
I am not sure about content compression when the content involves html with js doing ajax stuff. Sometimes the blocks of data exchanged through ajax are small and in this case (and if that is considered content) compression often hurts instead of helping. For example, a four bytes block of data produces a compressed block of 100+ bytes.