What’s new in ASP.NET 4.0
With Visual Studio 2010 Beta 1 and .NET Framework Beta 1 out for some time, this post is due from me for a long time. ASP.NET 4.0 has many improvements for different set of scenarios such as Webforms, Dynamic Data & AJAX based web development. There are also a lot of enhancements to the core runtime that powers ASP.NET such as Caching, Session & Request/Response objects.
For this post, we will examine some of the web form enhancements. There are sure a lot of them and we will examine some of them in the future posts.
Controlling View State using the ViewStateMode Property – Performance Enhancement
One of the most complained thing in ASP.NET Webform is the growing viewstate which becomes a concern for performance. While earlier you can set the EnableViewState property to true or false, post that, all the controls, by default inherit and even if you set it to enabled at control level, the behaviour was inconsistent.
With ASP.NET 4.0, the ViewStateMode property helps to determine for every control, whether the ViewState should be enabled, disabled or inherited accordingly. Ex.-
<asp:Panel ID="pnlViewState" runat="server" ViewStateMode="Disabled">
Disabled: <asp:Label ID="label1" runat="server" Text="Value set in markup" ViewStateMode="Inherit" /><br />
Enabled: <asp:Label ID="label2" runat="server" Text="Value set in markup" ViewStateMode="Enabled" />
<hr />
<asp:button ID="Button1" runat="server" Text="Postback" />
</asp:Panel>
In the code-behind
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
label1.Text = "Value set in code behind";
label2.Text = "Value set in code behind";
}
}
When you run the above page, you can find that the intial value for both the labels is set to “Value set in code behind” whereas after clicking on the button (postback), the value of label1 changes to “Value set in markup” whereas the value of label2 remains unchanged. As you can see, the Panel which holds both these lables has ViewStateMode set to Disabled and label1 is inherting the mode (this is the default if not specified) and label2 has it enabled. That is the reason label2 maintains viewstate while label1 loses it.
While it is arguably possible using the simple EnableViewState property earlier, it was never consistent. Considering the fact that in most of our performance sessions, we talk about disabling viewstate and then enabling it at control level while it doesnt work, this ViewStateMode is a welcome architectural change to improve performance.
Page Meta Keyword & Description – Search Engine Optimization feature
Upto Visual Studio 2008, one can set the Title of the page declaratively or through program using Page.Title. However, as more and more web traffic is happening through search engines, Page’s Title, Keyword and description become more important. Although the Keyword feature was exploited and hence many search engines today ignore it, Page Description is something still major search engines such as Google, Bing use for identifying and indexing pages based on content.
The new feature in ASP.NET 4.0 allows users to programmatically set the Page Description and Keywords as follows:-
protected void Page_Load(object sender, EventArgs e)
{
this.Page.Title = "My ASP.NET Blog";
this.Page.MetaKeywords = "ASP.NET, Web Development, Blog, ASP.NET Blog";
this.Page.MetaDescription = "This Blog contains posts related to ASP.NET and Web Development";
}
The above code appends the following markup
<meta name="keywords" content="ASP.NET, Web Development, Blog, ASP.NET Blog" />
<meta name="description" content="This Blog contains posts related to ASP.NET and Web Development" />
And the way it works is that, if the meta tags are already present in the HTML markup, whatever is set in the code behind will fill up the “content” part alone if the “name” tag is matching.
Although this looks simple, it is very useful in cases where you want to set these dynamically based on a condition / criteria. So far, these were set statically in the HTML. Now with Page Class level access, these can be set dynamically.
There are many more enhancements to Webforms such as Routing improvements, setting ClientID etc., which we will examine in the future posts.
Cheers !!!
Posted in: asp.net | Tags: asp.net asp.net 4.0 .net 4.0 meta keyword description seo eventargs webform clientid50 hot SEO Interview Questions
Technical / Tactics
Every SEO prefers certain tactics over others, but familiarity with many could indicate a deeper understanding of the industry. And while every SEO doesn't need to have a web developer background, having such skills can help set someone apart from the crowd.
- Give me a description of your general SEO experience.
- Can you write HTML code by hand?
- Could you briefly explain the PageRank algorithm?
- How you created any SEO tools either from scratch or pieced together from others?
- What do you think of PageRank?
- What do you think of using XML sitemaps?
- What are your thoughts on the direction of Web 2.0 technologies with regards to SEO?
- What SEO tools do you regularly use?
- Under what circumstances would you look to exclude pages from search engines using robots.txt vs meta robots tag?
- What areas do you think are currently the most important in organically ranking a site?
- Do you have experience in copywriting and can you provide some writing samples?
- Have you ever had something you've written reach the front-page of Digg? Sphinn? Or be Stumbled?
- Explain to me what META tags matter in today's world.
- Explain various steps that you would take to optimize a website?
- If the company whose site you've been working for has decided to move all of its content to a new domain, what steps would you take?
- Rate from 1 to 10, tell me the most important "on page" elements
- Review the code of past clients/company websites where SEO was performed.
- What do you think about link buying?
- What is Latent Semantic Analysis (LSI Indexing)?
- What is Phrase Based Indexing and Retrieval and what roles does it play?
- What is the difference between SEO and SEM?
- What kind of strategies do you normally implement for back links?
- What role does social media play in an SEO strategy?
- What things wouldn't you to do increase rankings because the risk of penalty is too high?
- What's the difference between PageRank and Toolbar PageRank?
- Why might you want to use nofollow on an internal link?
Analysis
A big part of SEO involves assessing the effectiveness of a campaign both relative to past performance as well as to competing sites.
- Are you familiar with web analytics and what packages are your familiar with?
- From an analytics perspective, what is different between a user from organic search results vs. a type-in user?
- How do you distinguish the results of your search optimization work from a seasonal change in traffic patterns?
- How do you evaluate whether an SEO campaign is working?
- What does competitive analysis mean to you and what techniques do you use?
- If you've done 6 months of SEO for a site and yet there haven't been any improvements, how would you go about diagnosing the problem?
- How many target keywords should a site have?
- How do *you* help a customer decide how to their budget between organic SEO and pay-per-click SEM?
- You hear a rumor that Google is weighting the HTML LAYER tag very heavily in ranking the relevance of its results – how does this affect your work?
- Why does Google rank Wikipedia for so many topics?
Industry Involvement
Is SEO just a job to pay the bills? Nothing wrong with that, but some senior positions can benefit from more enthusiasm and interest that can be measured by work done outside of the office.
- If salary and location were not an issue, who would you work for?
- In Google Lore – what are 'Hilltop', 'Florida' and 'Big Daddy'?
- Have you attended any search related conferences?
- Google search on this candidates name, (if you cannot find them, that's a red flag).
- Do you currently do SEO on your own sites? Do you operate any blogs? Do you currently do any freelance work and do you plan on continuing it?
- Of the well-known SEOs, who are you not likely to pay attention to?
- What are some challenges facing the SEO industry?
- What industry sites, blogs, and forums do you regularly read?
- Who are the two key people – who started Google?
- Who is Matt Cutts?
- If you were bidding on a contract, what competitor would you most worry about?
Open-Ended
These questions are more about how an answer is given rather than the actual answer. They often scare interviewees, but with no wrong answer they're actually a good opportunity to shine.
- Tell me your biggest failure in an SEO project
- What areas of SEO do you most enjoy?
- In what areas of SEO are you strongest?
- In what areas of SEO are you weakest?
- How do you handle a client who does not implement your SEO recommendations?
- Can you get "xyz"? company listed for the keyword "Google"? in the first page?
- What do you think is different about working for an SEO agency vs. doing SEO in-house?
- Why are you moving from your current position and/or leaving any current projects?