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="article-ads"> <div class="l-w-aside-i l-mt3 l-mh3 l-d-n l-d-f--3col l-fd-col l-fs0"> <div class="l-mb3"> <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-html hide-for-mobile-SP" id="maestro-765"><div class="proper-ad-unit"> <div id="proper-ad-sitepoint_sponsor_1"> <script> propertag.cmd.push(function() { proper_display('sitepoint_sponsor_1'); }); </script> </div> </div></div></div> <div class="widget maestro maestro-content-type-html " id="maestro-783"><adblock-msg data-sidebar="true"> <div class="Sticky"> <sp-job-ad /> </div> </adblock-msg></div><div class="widget maestro maestro-content-type-html hide-for-mobile-SP" id="maestro-763"><div class="proper-ad-unit"> <div id="proper-ad-sitepoint_side_1"> <script> propertag.cmd.push(function() { proper_display('sitepoint_side_1'); }); </script> </div> </div></div> </div> <div class="ArticleBox u-premium-preview"></div> <div class="ArticleAside_row"><div class="widget maestro maestro-content-type-html " id="maestro-728"><div class="proper-ad-unit"> <div id="proper-ad-sitepoint_side_2"> <script> propertag.cmd.push(function() { proper_display('sitepoint_side_2'); }); </script> </div> </div></div><div class="widget maestro maestro-content-type-html " id="maestro-730"><div class="proper-ad-unit Sticky"> <div id="proper-ad-sitepoint_side_3"> <script> propertag.cmd.push(function() { proper_display('sitepoint_side_3'); }); </script> </div> </div></div> <ads-weighted widget='21' data='{"NL":[{"id":"584","weight":"50","randMax":50},{"id":"585","weight":"50","randMax":100}]}' fallback='' url='setting-page-titles-2005-style' channelSlug='programming'></ads-weighted></div> <div class="ArticleAside_row ArticleAside_newboxads"></div> </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-fg1 l-mh3--2col l-mh0--4col"> <div class="widget maestro maestro-content-type-html hide-for-tablet-SP hide-for-mobile-SP" id="maestro-649"><span data-sumome-listbuilder-embed-id="6cbb401075afaa88f82a6ddc686573be3368d07928cf833fe1a56254d6ff9849"></span></div> <div id="commentsSection" class="l-pa3 t-bg-white"> </div> </div> </div> <script> var data = 'programming'; if (localStorage && localStorage.SP_categories) { data = JSON.parse(localStorage.SP_categories).toString(); data = data ? data.replace('-', '') : 'programming' } oSpP && oSpP.push('channel', data); </script> </div> <script> window.dataLayer = window.dataLayer || [] window.dataLayer.push({ post_id: 38518, title: "Setting Page Titles 2005 Style", category: "Programming", tags: [], authors: ["Philip Miseldine"], permalink: "https:\/\/www.sitepoint.com\/setting-page-titles-2005-style\/", published: "20040915", sponsored: false }) </script> <style type="text/css">.alm-btn-wrap .alm-load-more-btn{font-size:15px;font-weight:600;width:auto;height:42px;line-height:42px;background:#ed7070;color:#fff;border:none;border-radius:4px;margin:0 0 4px;padding:0 20px;display:inline-block;position:relative;-webkit-transition:all .35s ease;transition:all .35s ease;text-align:center;text-decoration:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;cursor:pointer}.alm-btn-wrap .alm-load-more-btn.loading,.alm-btn-wrap .alm-load-more-btn:hover{background-color:#e06464;color:#fff;text-decoration:none}.alm-btn-wrap .alm-load-more-btn:active{-webkit-box-shadow:inset 0 2px 1px rgba(0,0,0,.1);box-shadow:inset 0 2px 1px rgba(0,0,0,.1);text-decoration:none}.alm-btn-wrap .alm-load-more-btn.loading{cursor:default;outline:0;padding-left:44px}.alm-btn-wrap .alm-load-more-btn.done{cursor:default;opacity:.15;background-color:#ed7070;outline:0!important;-webkit-box-shadow:none!important;box-shadow:none!important}.alm-btn-wrap .alm-load-more-btn.done:before,.alm-btn-wrap .alm-load-more-btn:before{background:0 0;width:0}.alm-btn-wrap .alm-load-more-btn.loading:before{background:#fff url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/ajax-loader.gif) no-repeat center center;width:30px;height:30px;margin:6px;border-radius:3px;display:inline-block;z-index:0;content:'';position:absolute;left:0;top:0;overflow:hidden;-webkit-transition:width .5s ease-in-out;transition:width .5s ease-in-out}.alm-btn-wrap,.alm-masonry{display:block;overflow:hidden;clear:both}.alm-btn-wrap{text-align:center;padding:10px 0 25px}.ajax-load-more-wrap.blue .alm-load-more-btn{background-color:#0081bf}.ajax-load-more-wrap.blue .alm-load-more-btn.done,.ajax-load-more-wrap.blue .alm-load-more-btn.loading,.ajax-load-more-wrap.blue .alm-load-more-btn:hover{background-color:#0073aa}.ajax-load-more-wrap.green .alm-load-more-btn{background-color:#6fca68}.ajax-load-more-wrap.green .alm-load-more-btn.done,.ajax-load-more-wrap.green .alm-load-more-btn.loading,.ajax-load-more-wrap.green .alm-load-more-btn:hover{background-color:#64b95e}.ajax-load-more-wrap.red .alm-load-more-btn{background-color:#ca4b4b}.ajax-load-more-wrap.red .alm-load-more-btn.done,.ajax-load-more-wrap.red .alm-load-more-btn.loading,.ajax-load-more-wrap.red .alm-load-more-btn:hover{background-color:#b13b3b}.ajax-load-more-wrap.purple .alm-load-more-btn{background-color:#a86bb9}.ajax-load-more-wrap.purple .alm-load-more-btn.done,.ajax-load-more-wrap.purple .alm-load-more-btn.loading,.ajax-load-more-wrap.purple .alm-load-more-btn:hover{background-color:#9963a8}.ajax-load-more-wrap.grey .alm-load-more-btn{background-color:#888}.ajax-load-more-wrap.grey .alm-load-more-btn.done,.ajax-load-more-wrap.grey .alm-load-more-btn.loading,.ajax-load-more-wrap.grey .alm-load-more-btn:hover{background-color:#777}.ajax-load-more-wrap.white .alm-load-more-btn{background-color:#fff;color:#666;border:1px solid #efefef}.ajax-load-more-wrap.white .alm-load-more-btn.done,.ajax-load-more-wrap.white .alm-load-more-btn.loading,.ajax-load-more-wrap.white .alm-load-more-btn:hover{background-color:#efefef;color:#333}.ajax-load-more-wrap.white .alm-load-more-btn.done{border-color:#fff}.ajax-load-more-wrap.infinite .alm-load-more-btn{width:100%;background-color:transparent!important;background-position:center center;background-repeat:no-repeat;background-image:url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/spinner.gif);border:none!important;opacity:0;-webkit-transition:opacity .2s ease;transition:opacity .2s ease;-webkit-box-shadow:none!important;box-shadow:none!important;overflow:hidden;text-indent:-9999px;cursor:default!important;outline:0!important}.ajax-load-more-wrap.infinite .alm-load-more-btn:before{display:none!important}.ajax-load-more-wrap.infinite .alm-load-more-btn:active,.ajax-load-more-wrap.infinite .alm-load-more-btn:focus{outline:0}.ajax-load-more-wrap.infinite .alm-load-more-btn.done{opacity:0}.ajax-load-more-wrap.infinite .alm-load-more-btn.loading{opacity:1}.ajax-load-more-wrap.infinite.skype .alm-load-more-btn{background-image:url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/spinner-skype.gif)}.ajax-load-more-wrap.infinite.ring .alm-load-more-btn{background-image:url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/spinner-ring.gif)}.ajax-load-more-wrap.infinite.fading-blocks .alm-load-more-btn{background-image:url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/loader-fading-blocks.gif)}.ajax-load-more-wrap.infinite.fading-circles .alm-load-more-btn{background-image:url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/loader-fading-circles.gif)}.ajax-load-more-wrap.infinite.chasing-arrows .alm-load-more-btn{background-image:url(https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/img/spinner-chasing-arrows.gif)}.alm-listing{margin:0;padding:0}.alm-listing .alm-reveal{outline:0}.alm-listing .alm-paging-content>li,.alm-listing .alm-reveal>li,.alm-listing>li{background:0 0;margin:0 0 30px;padding:0 0 0 170px;overflow:hidden;position:relative;list-style:none}.alm-listing .alm-paging-content>li.no-img,.alm-listing .alm-reveal>li.no-img,.alm-listing>li.no-img{padding:0}.alm-listing .alm-paging-content>li p,.alm-listing .alm-reveal>li p,.alm-listing>li p{margin:0}.alm-listing .alm-paging-content>li p.entry-meta,.alm-listing .alm-reveal>li p.entry-meta,.alm-listing>li p.entry-meta{margin:0 0 5px;opacity:.75}.alm-listing .alm-paging-content>li h3,.alm-listing .alm-reveal>li h3,.alm-listing>li h3{margin:0 0 10px}.alm-listing .alm-paging-content>li img,.alm-listing .alm-reveal>li img,.alm-listing>li img{position:absolute;left:0;top:0;border-radius:2px}</style><div id="ajax-load-more" class="ajax-load-more-wrap infinite classic" data-alm-id="" data-canonical-url="https://www.sitepoint.com/setting-page-titles-2005-style/" data-slug="setting-page-titles-2005-style" data-post-id="38518" ><div aria-live="polite" class="alm-listing alm-ajax" data-container-type="div" data-repeater="default" data-post-type="post" data-category="asp-net,programming" data-post-not-in="38518" data-order="DESC" data-orderby="date" data-offset="0" data-posts-per-page="1" data-scroll="true" data-scroll-distance="-2000" data-max-pages="0" data-pause-override="true" data-pause="true" data-button-label="Older Posts" data-transition="fade" data-transition-container-classes=" next-article l-o-h" data-images-loaded="true"></div><div class="alm-btn-wrap" style="visibility: hidden;"><button class="alm-load-more-btn more " rel="next">Older Posts</button></div></div> </div> <div class="widget maestro maestro-content-type-html " id="maestro-775"><script type="text/html" class="ModalOnce" data-activate-delay="10" data-tracking="free-book" data-min-height="1" data-min-width="1"> <div id="free-book-modal" class="reveal-modal medium l-b-n l-br" data-reveal aria-labelledby="Free Book" aria-hidden="true" role="dialog"> <free-book-content book_cover="https://d2sis3lil8ndrq.cloudfront.net/books/4c7f6303-60e8-45dc-a95b-aae08a4f32a3_medium.png" heading="Free Book. All Yours." book_title="JavaScript Best Practice"> <p class="f-small l-mb3">Write powerful, clean and maintainable JavaScript with clear, practical lessons in application architecture, package management, tools, shorthands, callbacks, classes, flow control and much more.</p> <p class="f-small l-mb0">Worth $11.95 on Amazon. Yours FREE!</p> </free-book-content> <a class="close-reveal-modal" aria-label="Close">×</a> <free-book-form slug="js-best-practice-reader" /> </div> </script></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="/community/">Forums</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="https://sitepoint.typeform.com/to/fNY7XG">Corporate Memberships</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/premium/l/developer-jobs">Jobs</a> </li> <li class="l-ml3 f-c-grey-300 l-mb2"> <a class="Footer-link f-small" href="/premium/deals">Deals</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="/privacy-policy/">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="fab 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="fab fa-twitter-square l-i4"></i> </a> <a class="l-pl3 f-c-grey-300" href="https://www.sitepoint.com/feed/"> <i class="fas 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="fab 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 – 2019 SitePoint Pty. Ltd. </p> </ul> </div> </div> </div> </footer> <script type="text/javascript"> adroll_adv_id = "DJI3I3WGJBGL7PDJEDAYHV"; adroll_pix_id = "4RKMV6N56FGA7ANPGL4FQW"; (function() { window.adblocked = false; var onAdblock = function() { if (adblocked) return; window.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> <sp-cookie-warning></sp-cookie-warning> <!-- 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> <div class="widget maestro maestro-content-type-html " id="maestro-758"><script id="spout-tag-7c887d1e-c4ea-4682-bad8-216a89ce74e5"> (function() { var r = encodeURIComponent(top.document.referrer.substring(0,250)), p = encodeURIComponent(top.document.location.href.substring(0,250)), t = Date.now(), u = '7c887d1e-c4ea-4682-bad8-216a89ce74e5', e = document.createElement('script'), s = sessionStorage.getItem('spoutable-' + u); if (!s) { var m = Math.random.bind(Math); s = JSON.stringify({ sessionId: [ t, m(), m(), m(), m(), m(), m(), m(), m(), m(), m(), m(), m() ]}); sessionStorage.setItem('spoutable-' + u, s); } e.async = true; e.src='//s.spoutable.com/s?u='+u+'&s='+encodeURIComponent(s)+'&t='+t+'&r='+r+'&p='+p; document.head.appendChild(e); })(); </script></div><div class="widget maestro maestro-content-type-html hide-for-mobile-SP" id="maestro-746"><div class="proper-ad-unit ad-sticky"> <div id="proper-ad-sitepoint_main_1"> <script> propertag.cmd.push(function() { proper_display('sitepoint_main_1'); }); </script> </div> </div></div><script type='text/javascript'> /* <![CDATA[ */ var ratingsL10n = {"plugin_url":"https:\/\/www.sitepoint.com\/wp-content\/plugins\/wp-postratings","ajax_url":"https:\/\/www.sitepoint.com\/wp-admin\/admin-ajax.php","text_wait":"Please rate only 1 item at a time.","image":"thumbs","image_ext":"gif","max":"2","show_loading":"1","show_fading":"1","custom":"1"}; var ratings_1_mouseover_image=new Image();ratings_1_mouseover_image.src="https://www.sitepoint.com/wp-content/plugins/wp-postratings/images/thumbs/rating_1_over.gif";var ratings_2_mouseover_image=new Image();ratings_2_mouseover_image.src="https://www.sitepoint.com/wp-content/plugins/wp-postratings/images/thumbs/rating_2_over.gif";; /* ]]> */ </script> <script type='text/javascript' src='https://www.sitepoint.com/wp-content/plugins/wp-postratings/js/postratings-js.js?ver=1.85'></script> <script type='text/javascript' src='//www.sitepoint.com/wp-content/themes/sitepoint/assets/javascripts/scripts-foot-8f13c986d91e043a69329ed8a16fc0e4.js?ver=4.9.8'></script> <script type='text/javascript' src='//www.sitepoint.com/wp-content/themes/sitepoint/assets/javascripts/bundle-bb78f3f0673029dc1b500871c5e802a4.js'></script> <script type='text/javascript' src='//www.sitepoint.com/wp-content/themes/sitepoint/assets/javascripts/article-8de8a23a50330da6449e0b5250ccd100.js'></script> <script type='text/javascript' src='https://www.sitepoint.com/wp-includes/js/wp-embed.min.js?ver=4.9.8'></script> <script type='text/javascript'> /* <![CDATA[ */ var alm_localize = {"ajaxurl":"https:\/\/www.sitepoint.com\/wp-admin\/admin-ajax.php","restapi":{"active":false,"url":"https:\/\/www.sitepoint.com\/wp-json\/","namespace":"ajaxloadmore"},"alm_nonce":"e37af64a4e","pluginurl":"https:\/\/www.sitepoint.com\/wp-content\/plugins\/ajax-load-more","scrolltop":"false","speed":"250","results_text":"Displaying page {num} of {total}.","no_results_text":"No results found."}; var ajax_load_more_vars = {"id":"ajax-load-more"}; /* ]]> */ </script> <script type='text/javascript' src='https://www.sitepoint.com/wp-content/plugins/ajax-load-more/core/dist/js/ajax-load-more.min.js?ver=5.1.0.1'></script> </body> </html> <!-- Performance optimized by W3 Total Cache. Learn more: https://www.w3-edge.com/products/ Object Caching 17/64 objects using memcached Page Caching using memcached Content Delivery Network via Amazon Web Services: CloudFront: dab1nmslvvntp.cloudfront.net Served from: www.sitepoint.com @ 2019-06-25 19:56:47 by W3 Total Cache -->