Programming - - By Philip Miseldine

Setting Page Titles 2005 Style

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> <p>Now, you can set the page easily using:</p> <p><code><br /> this.Title = "My new page title";</code></p> <p>Simple as!</p> <div class="Article_authorBio l-mv4 t-bg-white m-border l-pa3"> <div class="l-d-f l-pt3"> <a class="l-s5 l-pa0 l-mr3 l-round l-o-h" href="https://www.sitepoint.com/author/philip-miseldine/"> <img src="https://secure.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" /> </a> <div class="f-lh-title"> <div class="f-c-grey-300">Meet the author</div> <div class="f-large"> <a class="f-bold f-c-grey-500" href="https://www.sitepoint.com/author/philip-miseldine/"> Philip Miseldine </a> </div> </div> </div> <div class="f-light f-lh-copy l-mt3">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> </div> </div> </div> <div class="l-w-aside-i l-mt6 l-mh3 l-d-n l-d-f--3col l-fd-col l-fs0"> <div class="l-mb3"> <div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-1"><!-- SP2013_Articles_300x250_1 --> <div id="div-gpt-ad-1392428092543-0" style="" class="adspot "> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1392428092543-0"); });</script> <script type="text/javascript"> window.SP_GPT_Slots.push({ id : "1392428092543-0", name : "SP2013_Articles_300x250_1", sizes : [300,250], desktop : 1, tablet : 1, phone : 0 }); </script> </div></div> </div> <sp-heading content="Sponsors"></sp-heading> <div class="l-w-100 l-mv3 t-bg-white m-border"><div class="widget maestro maestro-content-type-bsa hide-for-mobile-SP" id="maestro-448"><div class="l-pa3" style="border-bottom: 1px solid #e5e5e5" id="maestro-448-bsa-152565"> <a href="//srv.buysellads.com/ads/click/x/GTND42QECY7DE5QICYBLYKQMCTSDC2JWCWAILZ3JCWYDK23JCV7DKKQKC6BIT2JICTYI6K3EHJNCLSIZ" class="l-d-f l-ai-sta" data-ga-on="click" data-ga-event-category="maestro" data-ga-event-label="maestro-448-bsa-152565" data-ga-event-action="click" > <img class="l-s5" src="//assets.servedby-buysellads.com/p/manage/asset/id/58333"> <div class="f-small l-d-f l-fd-col l-ml3 f-lh-title f-c-grey-700"> <span class="f-bold">Google Cloud</span> <span>Get a 12-month free trial to get you started on GCP. Try it free today.</span> </div> </a> </div><img src="https://ad.doubleclick.net/ddm/trackimp/N5295.1676840CARBONADS.COM/B10444636.202856959;dc_trk_aid=402517341;dc_trk_cid=75142946;ord=[1506302006];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=?" height="1" width="1" border="0" style="display: none;" /><div class="l-pa3" style="border-bottom: 1px solid #e5e5e5" id="maestro-448-bsa-149810"> <a href="//srv.buysellads.com/ads/click/x/GTND42QECY7DE5QICYBLYKQMCTSDC2JJFTBDTZ3JCWYDK23JCASDL53KC6BIT2JICTYI6K3EHJNCLSIZ" class="l-d-f l-ai-sta" data-ga-on="click" data-ga-event-category="maestro" data-ga-event-label="maestro-448-bsa-149810" data-ga-event-action="click" > <img class="l-s5" src="//assets.servedby-buysellads.com/p/manage/asset/id/57125"> <div class="f-small l-d-f l-fd-col l-ml3 f-lh-title f-c-grey-700"> <span class="f-bold">Microsoft Azure</span> <span>Kick-start your open source projects with access to hundreds of frameworks</span> </div> </a> </div><img src="https://ad.doubleclick.net/ddm/trackimp/N572608.452584BUYSELLADS.COM0/B20073109.201116379;dc_trk_aid=401148941;dc_trk_cid=90752671;ord=[1506302006];dc_lat=;dc_rdid=;tag_for_child_directed_treatment=?" height="1" width="1" border="0" style="display: none;" /><img src="https://pixel.adsafeprotected.com/rfw/st/96690/16734277" height="1" width="1" border="0" style="display: none;" /><script>ga('SitePointPlugin:observeImpressions', ['maestro-448-bsa-152565','maestro-448-bsa-149810'])</script></div></div> <div class="ArticleBox u-premium-preview"></div> <div class="ArticleAside_row ArticleAside_newboxads"><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-251"><!-- 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> <script type="text/javascript"> window.SP_GPT_Slots.push({ id : "1436815711585-0", name : "SP_Articles_200x125_1", sizes : [200,125], desktop : 1, tablet : 1, phone : 0 }); </script> </div></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-252"><!-- 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> <script type="text/javascript"> window.SP_GPT_Slots.push({ id : "1436815711585-1", name : "SP_Articles_200x125_2", sizes : [200,125], desktop : 1, tablet : 1, phone : 0 }); </script> </div></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-253"><!-- 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> <script type="text/javascript"> window.SP_GPT_Slots.push({ id : "1436815711585-2", name : "SP_Articles_200x125_3", sizes : [200,125], desktop : 1, tablet : 1, phone : 0 }); </script> </div></div><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-254"><!-- 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> <script type="text/javascript"> window.SP_GPT_Slots.push({ id : "1436815711585-3", name : "SP_Articles_200x125_4", sizes : [200,125], desktop : 1, tablet : 1, phone : 0 }); </script> </div></div></div> <div class="ArticleAside_row"><div class="widget maestro maestro-content-type-ad hide-for-mobile-SP" id="maestro-56"><!-- SP2013_Articles_300x600_1 --> <div id="div-gpt-ad-1392428092543-4" style="" class="adspot na"> <script type="text/javascript">googletag.cmd.push(function() { googletag.display("div-gpt-ad-1392428092543-4"); });</script> <script type="text/javascript"> window.SP_GPT_Slots.push({ id : "1392428092543-4", name : "SP2013_Articles_300x600_1", sizes : [[300, 600], [300, 250], [160, 600]], desktop : 1, tablet : 1, phone : 0 }); </script> </div></div> <ads-weighted widget='21' data='{"NL":[{"id":"585","demandbase_field":null,"demandbase_value":null,"weight":"50","randMax":50},{"id":"584","demandbase_field":null,"demandbase_value":null,"weight":"50","randMax":100}]}' fallback='' url='setting-page-titles-2005-style' channelSlug='programming'></ads-weighted></div> </div> </div> <div class="u-accordion-end"></div> <div class="l-d-f l-jc-sb l-w-3col--3col l-mh-auto"> <div class="u-showseriesx l-w-100 l-w-2col-i--2col l-fg1 l-mh3--2col l-mh0--4col"> <ads-weighted widget='6' data='{"fallback":[{"id":"649","demandbase_field":null,"demandbase_value":null,"weight":"50","randMax":50}]}' fallback='' url='setting-page-titles-2005-style' channelSlug='programming'></ads-weighted> <div id="commentsSection" class="l-pa3 t-bg-white"> <a id="comments"></a> </div> </div> </div> <script> OneSignal.push(function() { OneSignal.sendTags({ programming: 'programming', }); }); </script> </div> </div> <footer role="contentinfo"> <div class="l-w-100 l-d-f Footer-bg"> <div class="l-d-f l-fw-w l-mh-auto"> <div class="l-d-f l-fw-w l-mt4 l-w-100 l-pa3 l-w-3col--4col l-jc-sb l-jc-sa--4col"> <ul> <li class="t-ls-n"> <div class="f-c-white f-large f-bold l-mb2">Stuff We Do</div> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/premium/">Premium</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/versioning/">Versioning</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/themes/">Themes</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/community/">Forums</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/html-css/css/">References</a> </li> </ul> <ul> <li class="t-ls-n"> <div class="f-c-white f-large f-bold l-mb2">About</div> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/about-us/">Our Story</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/press/">Press Room</a> </li> </ul> <ul> <li class="t-ls-n"> <div class="f-c-white f-large f-bold l-mb2">Contact</div> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/contact-us/">Contact Us</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="https://sitepoint.zendesk.com/hc/en-us">FAQ</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/write-for-us/">Write for Us</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/advertise/">Advertise</a> </li> </ul> <ul> <li class="t-ls-n"> <div class="f-c-white f-large f-bold l-mb2">Legals</div> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/legals/">Terms of Use</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/legals/#privacy">Privacy Policy</a> </li> </ul> </div> <div class="l-d-n l-d-b--4col l-as-cen Footer-hr" > </div> <div class="l-mt4 l-pa3 l-w-1col--4col"> <ul class="t-ls-n l-d-f l-fw-w l-d-b--3col"> <li> <div class="f-c-white f-large f-bold l-mb2 l-mr3">Connect</div> </li> <li class="f-center"> <a class="f-c-grey-300" href="https://www.facebook.com/sitepoint" rel="noopener" target="_blank"> <i class="fa fa-facebook-square l-i4"></i> </a> <a class="l-pl3 f-c-grey-300" href="http://twitter.com/sitepointdotcom" rel="noopener" target="_blank"> <i class="fa fa-twitter-square l-i4"></i> </a> <a class="l-pl3 f-c-grey-300" href="/versioning/"> <i class="fa fa-envelope-square l-i4"></i> </a> <a class="l-pl3 f-c-grey-300" href="https://www.sitepoint.com/feed/"> <i class="fa fa-rss-square l-i4"></i> </a> <a class="l-pl3 f-c-grey-300" href="https://plus.google.com/+sitepoint" rel="noopener" target="_blank"> <i class="fa fa-google-plus-square l-i4"></i> </a> </li> <p class="f-c-grey-300 l-mh-auto l-ml3--2col l-ml0--3col l-mv3--4col f-small f-center"> © 2000 – 2017 SitePoint Pty. Ltd. </p> </ul> </div> </div> </div> <div class="l-w-100 l-d-f t-bg-white l-jc-cen"> <div class="l-mv5 l-d-f l-fw-w l-jc-cen"> <span class="f-bold l-as-cen f-large f-c-grey-300 l-mr3 l-mb3 l-mb0--2col">Recommended Hosting Partner:</span> <a href="https://www.siteground.com/go/sitepoint-siteground-promo"> <img class="l-ml5--2col" src="//www.sitepoint.com/wp-content/themes/sitepoint/assets/images/siteground.png" /> </a> </div> </div> </footer> <script type="text/javascript"> adroll_adv_id = "DJI3I3WGJBGL7PDJEDAYHV"; adroll_pix_id = "4RKMV6N56FGA7ANPGL4FQW"; (function () { var adblocked = false; var onAdblock = function() { if(adblocked) return; adblocked = true; gaEventQueue && gaEventQueue.track('CanSeeAds', 'adrollBlocked', {'nonInteraction': true}); Array.prototype.slice.call(document.getElementsByClassName('CantSeeAds')) .forEach(function(el) { el.className = el.className.replace('CantSeeAds', ''); }); }; var _onload = function(){ if (document.readyState && !/loaded|complete/.test(document.readyState)){setTimeout(_onload, 10);return} if (!window.__adroll_loaded){__adroll_loaded=true;setTimeout(_onload, 50);return} var scr = document.createElement("script"); var host = (("https:" == document.location.protocol) ? "https://s.adroll.com" : "http://a.adroll.com"); scr.setAttribute('async', 'true'); scr.type = "text/javascript"; scr.src = host + "/j/roundtrip.js"; scr.onerror = onAdblock; ((document.getElementsByTagName('head') || [null])[0] || document.getElementsByTagName('script')[0].parentNode).appendChild(scr); }; if (window.addEventListener) {window.addEventListener('load', _onload, false);} else {window.attachEvent('onload', _onload)} }()); </script> <script> (function(d,b,a,s,e){ var t = b.createElement(a), fs = b.getElementsByTagName(a)[0]; t.async=1; t.id=e; t.src=s; fs.parentNode.insertBefore(t, fs); }) (window,document,'script','https://scripts.demandbase.com/IM2QfEma.min.js','demandbase_js_lib'); </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 = "https://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.tagName == 'A') { 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 data-cfasync="false"> (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.setAttribute('data-cfasync', 'false'); e.src = h+"//"+u+"/p.js"; r.appendChild(e); })("script", "parsely", document); </script> <!-- END Parse.ly Include: Standard --> <script type="text/javascript"> (function(googletag, SP_GPT_Slots) { if(!SP_GPT_Slots.length) return; var SP_GPT_First_Slot_Rendered = false; googletag.cmd.push(function(){ googletag.pubads().addEventListener("slotRenderEnded", function(e){ if (!SP_GPT_First_Slot_Rendered) { gaEventQueue.track("CanSeeAds", "dfpFirstRendered", {"nonInteraction": true}); SP_GPT_First_Slot_Rendered = true; } }); }); })(googletag, SP_GPT_Slots); </script> <script type='text/javascript' src='//www.sitepoint.com/wp-content/themes/sitepoint/assets/javascripts/scripts-foot-dfb2dddf3e07e06b11282e3f2248e361.js?ver=4.8.1'></script> <script type='text/javascript' src='//www.sitepoint.com/wp-content/themes/sitepoint/assets/dynamic/compiled-84ea2c64a9ae27e774e0d6c53a85ed86.js?ver=4.8.1'></script> <script type='text/javascript' src='https://www.sitepoint.com/wp-includes/js/wp-embed.min.js?ver=4.8.1'></script> <script> jQuery(document).ready(function() { jQuery('.lazyYT').each(function() { var id = jQuery(this).data('youtube-id'), url = 'https://www.youtube.com/watch?v=' + id; jQuery(this).replaceWith('<a href="' + url + '">' + url + '</a>'); }); }); </script> </body> </html> <!-- Performance optimized by W3 Total Cache. Learn more: https://www.w3-edge.com/products/ Object Caching 1158/1227 objects using memcached Page Caching using memcached (SSL caching disabled) Content Delivery Network via Amazon Web Services: CloudFront: dab1nmslvvntp.cloudfront.net Served from: www.sitepoint.com @ 2017-09-24 18:13:26 by W3 Total Cache -->