Little tip.

To set the page title on an ASP.NET Web From using Whidbey, add runat=”server” properties to the head and title tags in your HTML:




<br /> </head></code> <p>Now, you can set the page easily using:</p> <p><code><br /> this.Title = "My new page title";</code> <p>Simple as!</p> </div> <div class="Author t-border"> <div class="Author_header"> <a href="http://www.sitepoint.com/author/philip-miseldine/"> <img src="http://1.gravatar.com/avatar/ac68fbf57913531cc509000d75beddab?s=96&d=mm&r=g" width="96" height="96" alt="" class="avatar avatar-96 wp-user-avatar wp-user-avatar-96 photo avatar-default" /> <span class="Author_name t-color"> Philip Miseldine </span> </a> <div class="Author_social"> </div> </div> <div class="Author_bio">Philip is a Computer Science PhD student at Liverpool John Moores University. He's still not mastered guitar tabs, never finished Mario, and needs a haircut. He discusses life at <a href="http://www.miseldine.com/">http://www.miseldine.com/</a>.</div> </div> <div class="ArticleContent_endcap"> <div class="widget maestro maestro-content-type-product " id="maestro-product-38"><div class="promo-panel_media-object"><img src="http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2015/05/1432700451Go_Book_Cover_AB.png" /></div> <div class="promo-panel_content"> <h1 class="promo-panel_title"> Get your <strong>free chapter</strong> of <em>Level Up Your Web Apps with Go</em> </h1> <p>Get a <strong>free chapter</strong> of <em>Level Up Your Web Apps with Go</em>, plus updates and exclusive offers from SitePoint.</p> <form class="promo-panel_action"><input type="email" name="email" class="promo-panel_email" placeholder="email address" /><input type="hidden" name="content" value="38" /><button class="button radius">Yes please!</button></form> </div></div> </div> <div class="ArticleLeaderboard"> <div class="ArticleLeaderboard_ad"> <div class="widget maestro maestro-content-type-html hide-for-mobile-SP" id="maestro-product-68"><adblock-msg data-message="Microsoft - helping keep SitePoint free"></adblock-msg></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-181"><!-- SP_Articles_728x90_Bottom --> <div id="div-gpt-ad-1438136496246-0" style="" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1438136496246-0"); });</script> </div></div> </div> <hr /> </div> <a id="comments"></a> <div id="disqus_thread"> <div id="dsq-content"> <ul id="dsq-comments"> <li class="comment even thread-even depth-1" id="dsq-comment-28789"> <div id="dsq-comment-header-28789" class="dsq-comment-header"> <cite id="dsq-cite-28789"> <span id="dsq-author-user-28789">Cory M.</span> </cite> </div> <div id="dsq-comment-body-28789" class="dsq-comment-body"> <div id="dsq-comment-message-28789" class="dsq-comment-message"><p>Ooh, very nice.</p> </div> </div> </li><!-- #comment-## --> <li class="comment odd alt thread-odd thread-alt depth-1" id="dsq-comment-28790"> <div id="dsq-comment-header-28790" class="dsq-comment-header"> <cite id="dsq-cite-28790"> <span id="dsq-author-user-28790">andre</span> </cite> </div> <div id="dsq-comment-body-28790" class="dsq-comment-body"> <div id="dsq-comment-message-28790" class="dsq-comment-message"><p>uh, how do you do this under ASP.NET 1.1? using client-side javascript?</p> </div> </div> </li><!-- #comment-## --> <li class="comment even thread-even depth-1" id="dsq-comment-28791"> <div id="dsq-comment-header-28791" class="dsq-comment-header"> <cite id="dsq-cite-28791"> http://www.spiffdog.com <span id="dsq-author-user-28791">Spiff Dog</span> </cite> </div> <div id="dsq-comment-body-28791" class="dsq-comment-body"> <div id="dsq-comment-message-28791" class="dsq-comment-message"><p>Just outta curiousity, are they putting that class in the HtmlControls or WebControls namespace?</p> </div> </div> </li><!-- #comment-## --> <li class="comment odd alt thread-odd thread-alt depth-1" id="dsq-comment-28792"> <div id="dsq-comment-header-28792" class="dsq-comment-header"> <cite id="dsq-cite-28792"> http://www.miseldine.com <span id="dsq-author-user-28792">miseldine</span> </cite> </div> <div id="dsq-comment-body-28792" class="dsq-comment-body"> <div id="dsq-comment-message-28792" class="dsq-comment-message"><p>Andre: You need to set the page title tag as with .NET 2.0 (i.e. with a runat=”server”) but define the following in your codebehind:</p> <p><code><br /> Protected pageTitle As System.Web.UI.HtmlControls.HtmlGenericControl</p> <p> Private Sub Page_Load(ByVal sender As System.Object, _<br /> ByVal e As System.EventArgs) Handles MyBase.Load</p> <p> pageTitle.InnerText = "Title"</p> <p> End Sub</code> <p>Spiff Dog: Its a string property on the Page class…</p> <p>“this.” is just an easy way of referencing the current instance :) So, its the System.Web.UI.Page class technically :P</p> </div> </div> </li><!-- #comment-## --> <li class="comment even thread-even depth-1" id="dsq-comment-28793"> <div id="dsq-comment-header-28793" class="dsq-comment-header"> <cite id="dsq-cite-28793"> http://www.webprofessionaltemplates.com <span id="dsq-author-user-28793">essive</span> </cite> </div> <div id="dsq-comment-body-28793" class="dsq-comment-body"> <div id="dsq-comment-message-28793" class="dsq-comment-message"><p>Creating all of that code just for a title, of course, really doesn’t buy you much. You should really consider placing page titles, descriptions and keywords in the web.config file user defined section such as:<br /> <webpages><br /> <contact .aspx><br /> <add key="title" value="About Us"></add><br /> <add key="desc" value="Contact information about our company!"></add><br /> </contact><br /> </webpages></p> <p>and then reference this using the script name from the web pages. This allows easy page editing in a single file.</p> </div> </div> </li><!-- #comment-## --> </ul> </div> </div> <script type="text/javascript"> var disqus_url = 'http://www.sitepoint.com/setting-page-titles-2005-style/'; var disqus_identifier = '38518 http://492824695'; var disqus_container_id = 'disqus_thread'; var disqus_shortname = 'sitepointproduction'; var disqus_title = "Setting Page Titles 2005 Style"; var disqus_config_custom = window.disqus_config; var disqus_config = function () { /* All currently supported events: onReady: fires when everything is ready, onNewComment: fires when a new comment is posted, onIdentify: fires when user is authenticated */ this.language = ''; this.callbacks.onReady.push(function () { // sync comments in the background so we don't block the page var script = document.createElement('script'); script.async = true; script.src = '?cf_action=sync_comments&post_id=38518'; var firstScript = document.getElementsByTagName('script')[0]; firstScript.parentNode.insertBefore(script, firstScript); }); if (disqus_config_custom) { disqus_config_custom.call(this); } }; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> </div> <div class="ArticleAside"> <div class="ArticleAside_row"> <div class="widget maestro maestro-content-type-html hide-for-mobile-SP" id="maestro-product-67"><adblock-msg data-sidebar="true" data-message="Microsoft - helping keep SitePoint free"></adblock-msg></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-1"><!-- SP2013_Articles_300x250_1 --> <div id="div-gpt-ad-1392428092543-0" style="width:300px; height:250px;" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1392428092543-0"); });</script> </div></div> </div> <div class="ArticleBox"> <h3 class="ArticleBox_header t-bg"> <i class="ArticleBox_icon fa fa-coffee"></i> Recommended for you </h3> <div class="ArticleBox_content"> <ul class="ArticleBox_list t-list"> <li><a href="http://www.sitepoint.com/watch-combining-dynamic-strings-through-concatenation-with-python/?utm_source=sitepoint&utm_medium=relatedsidebar&utm_term=programming" data-kz-track-on-click="2470">Watch: Combining Dynamic Strings with Python</a></li> <li><a href="http://www.sitepoint.com/implementing-titlecapitalization-stackedit/?utm_source=sitepoint&utm_medium=relatedsidebar&utm_term=programming" data-kz-track-on-click="2470">Implementing TitleCapitalization in StackEdit</a></li> <li><a href="http://www.sitepoint.com/build-a-web-game-in-an-hour-with-visual-studio-and-asp-net/?utm_source=sitepoint&utm_medium=relatedsidebar&utm_term=programming" data-kz-track-on-click="2470">Build a Web Game in an Hour with Visual Studio and ASP.NET</a></li> <li><a href="http://www.sitepoint.com/deploying-a-django-app-with-mod_wsgi-on-ubuntu-14-04/?utm_source=sitepoint&utm_medium=relatedsidebar&utm_term=programming" data-kz-track-on-click="2470">Deploying a Django App with mod_wsgi on Ubuntu 14.04</a></li> <li><a href="http://www.sitepoint.com/best-programming-language-learn-2015-job-demand-salaries/?utm_source=sitepoint&utm_medium=relatedsidebar&utm_term=programming" data-kz-track-on-click="2470">Best Programming Languages For Job Demand and Salaries, 2015</a></li> </ul> </div> </div> <div class="ArticleBox u-premium-preview"><div class="widget maestro maestro-content-type-spad " id="maestro-product-1"><div class="SPAdPanel"> <div class="ArticleBox_header"> <i class="ArticleBox_icon fa fa-rocket"></i> Related books & courses </div> <div class="ArticleBox_content"> <div class="SPAdPanel_content"> <div class="SPAdPanel_tagline">Available now on SitePoint Premium</div> <p class="SPAdPanel_creative">Preview for $1</p> </div> <div class="SPAdPanel_cta"> <a class="SPAdPanel_ctaButton button" href=https://www.sitepoint.com/premium/preview>Start Preview</a> </div> </div> </div></div></div> <div class="ArticleAside_row ArticleAside_newboxads"><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-177"><!-- SP_Articles_200x125_1 --> <div id="div-gpt-ad-1436815711585-0" style="" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1436815711585-0"); });</script> </div></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-178"><!-- SP_Articles_200x125_2 --> <div id="div-gpt-ad-1436815711585-1" style="" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1436815711585-1"); });</script> </div></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-179"><!-- SP_Articles_200x125_3 --> <div id="div-gpt-ad-1436815711585-2" style="" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1436815711585-2"); });</script> </div></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-180"><!-- SP_Articles_200x125_4 --> <div id="div-gpt-ad-1436815711585-3" style="" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1436815711585-3"); });</script> </div></div></div> <div class="ArticleAside_row"><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-product-49"><!-- SP2013_Articles_300x600_1 --> <div id="div-gpt-ad-1392428092543-4" style="" class="adspot Sticky"> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1392428092543-4"); });</script> </div></div></div> </div> </div> <div class="u-accordion-end"></div> <div class="ChannelPanel t-bg"> <strong class="ChannelPanel_context">Next Article</strong> <a class="ChannelPanel_heading" href="http://www.sitepoint.com/deploying-a-django-app-with-mod_wsgi-on-ubuntu-14-04/?utm_source=sitepoint&utm_medium=nextpost&utm_term=programming" data-kz-track-on-click="2470"> <span class="ChannelPanel_underline">Deploying a Django App with mod_wsgi on Ubuntu 14.04</span> <i class="fa fa-arrow-right"></i> </a> </div> </div> <div class="widget maestro maestro-content-type-html hide-for-mobile-SP" id="maestro-product-45"><js-recapture type="web" title="Best Programming Languages For Job Demand and Salaries, 2015" href="http://www.sitepoint.com/best-programming-language-learn-2015-job-demand-salaries/?utm_source=sitepoint&utm_medium=recapture&utm_campaign=web"></js-recapture></div> <sub-footer></sub-footer> <footer class="Footer" role="contentinfo"> <div class="Footer-inner"> <ul class="FooterList"> <li class="FooterList_item"> <h3>About</h3> </li> <li class="FooterList_item"> <a href="/about-us">Our Story</a> </li> <li class="FooterList_item"> <a href="/advertising">Advertise</a> </li> <li class="FooterList_item"> <a href="/press">Press Room</a> </li> <li class="FooterList_item"> <a href="http://reference.sitepoint.com/css" target="_blank">Reference</a> </li> <li class="FooterList_item"> <a href="/legals">Terms of Use</a> </li> <li class="FooterList_item"> <a href="/legals/#privacy">Privacy Policy</a> </li> <li class="FooterList_item"> <a href="https://sitepoint.zendesk.com/hc/en-us" target="_blank">FAQ</a> </li> <li class="FooterList_item"> <a href="mailto:feedback@sitepoint.com">Contact Us</a> </li> <li class="FooterList_item"> <a href="/write-for-us">Contribute</a> </li> </ul> <ul class="FooterList"> <li class="FooterList_item"> <h3>Visit</h3> </li> <li class="FooterList_item"> <a href="/">SitePoint Home</a> </li> <li class="FooterList_item"> <a href="http://community.sitepoint.com">Forums</a> </li> <li class="FooterList_item"> <a href="/newsletter">Newsletters</a> </li> <li class="FooterList_item"> <a href="/premium">Premium</a> </li> <li class="FooterList_item"> <a href="/sass-reference">References</a> </li> <li class="FooterList_item"> <a href="/store">Store</a> </li> <li class="FooterList_item"> <a href="/versioning">Versioning</a> </li> </ul> <ul class="FooterList"> <li class="FooterList_item"> <h3>Connect</h3> </li> <li class="FooterList_item FooterList_item--icons"> <a href="/feed/"> <i class="fa fa-rss-square"></i> </a> <a href="/newsletter/"> <i class="fa fa-envelope-square"></i> </a> <a href="https://www.facebook.com/sitepoint" target="_blank"> <i class="fa fa-facebook-square"></i> </a> <a href="http://twitter.com/sitepointdotcom" target="_blank"> <i class="fa fa-twitter-square"></i> </a> <a href="https://plus.google.com/+sitepoint" target="_blank"> <i class="fa fa-google-plus-square"></i> </a> </li> </ul> <p class="Footer_copyright"> © 2000 – 2015 SitePoint Pty. Ltd. </p> </div> </footer> <div id="search-dropdown"> <div data-role="search-for"> <a class="search-link" href="#">Search for...</a> </div> <ul data-role="results"></ul> </div> <script type="text/javascript">var sp_canSeeAds;</script> <script type="text/javascript" src="http://www.sitepoint.com/wp-content/themes/sitepoint/assets/javascripts/ad-server.js"></script> <script type='text/javascript'><!-- var seriesdropdown = document.getElementById("orgseries_dropdown"); if (seriesdropdown) { function onSeriesChange() { if ( seriesdropdown.options[seriesdropdown.selectedIndex].value != ( 0 || -1 ) ) { location.href = "http://www.sitepoint.com/series/"+seriesdropdown.options[seriesdropdown.selectedIndex].value; } } seriesdropdown.onchange = onSeriesChange; } --></script> <script type="text/javascript"> // <![CDATA[ var disqus_shortname = 'sitepointproduction'; (function () { var nodes = document.getElementsByTagName('span'); for (var i = 0, url; i < nodes.length; i++) { if (nodes[i].className.indexOf('dsq-postid') != -1) { nodes[i].parentNode.setAttribute('data-disqus-identifier', nodes[i].getAttribute('data-dsqidentifier')); url = nodes[i].parentNode.href.split('#', 1); if (url.length == 1) { url = url[0]; } else { url = url[1]; } nodes[i].parentNode.href = url + '#disqus_thread'; } } var s = document.createElement('script'); s.async = true; s.type = 'text/javascript'; s.src = '//' + disqus_shortname + '.disqus.com/count.js'; (document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s); }()); // ]]> </script> <!-- START Parse.ly Include: Standard --> <div id="parsely-root" style="display: none"> <div id="parsely-cfg" data-parsely-site="sitepoint.com"></div> </div> <script> (function(s, p, d) { var h=d.location.protocol, i=p+"-"+s, e=d.getElementById(i), r=d.getElementById(p+"-root"), u=h==="https:"?"d1z2jf7jlzjs58.cloudfront.net" :"static."+p+".com"; if (e) return; e = d.createElement(s); e.id = i; e.async = true; e.src = h+"//"+u+"/p.js"; r.appendChild(e); })("script", "parsely", document); </script> <!-- END Parse.ly Include: Standard --> <!-- Scroll Triggered Boxes v2.0.2 - https://wordpress.org/plugins/scroll-triggered-boxes/--> <div class="stb-container stb-bottom-left-container"> <div class="scroll-triggered-box stb stb-111076 stb-bottom-left" id="stb-111076" style="display: none;"> <div class="stb-content"> <p style="text-align: center; font-size: 120%; font-colour: #ffffff;"> <img class="logo" src="http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2015/07/1437632566Screen-Shot-2015-07-23-at-4.19.46-pm.png" alt="Screen Shot 2015-07-23 at 4.19.46 pm" width="150" height="26" /></p> <p style="text-align: center; font-size: 120%; font-colour: #ffffff;">Get a <strong>free</strong> year of<br /> SitePoint Premium +<br /> hosting from BlueHost<br /> for $3.50/month</p> <p style="text-align: center;"><strong><a class="myButton" href="http://bluehost.com/track/sitepointmedia/sp_slideup?page=/affiliate/learnable">Get this deal</a></strong></p> <p style="text-align: center;"><img class="logo" src="http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2015/07/1437631923Bluehost_logo.png" alt="" width="125" height="40" /></p> </div> <span class="stb-close">×</span> </div> </div> <div id="stb-overlay"></div><!-- / Scroll Triggered Box --><script type='text/javascript' src='//www.sitepoint.com/wp-content/themes/sitepoint/assets/javascripts/scripts-foot-9010958176a94befbe45005b802edd43.js?ver=4.2.2'></script> <script type='text/javascript'> /* <![CDATA[ */ var STB_Global_Options = {"testMode":""}; var STB_Box_Options = {"111076":{"id":111076,"title":"2015_Bluehost_Box_01","trigger":"percentage","triggerPercentage":65,"triggerElementSelector":"","animation":"slide","cookieTime":7,"autoHide":false,"autoShow":true,"position":"bottom-left","minimumScreenWidth":400}}; /* ]]> */ </script> <script type='text/javascript' src='http://www.sitepoint.com/wp-content/plugins/scroll-triggered-boxes/assets/js/script.min.js?ver=2.0.2'></script> </body> </html> <!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/ Page Caching using memcached Object Caching 2026/2073 objects using memcached Content Delivery Network via Amazon Web Services: CloudFront: dab1nmslvvntp.cloudfront.net Served from: www.sitepoint.com @ 2015-08-31 13:54:34 by W3 Total Cache -->