How to get DocTitle from aspx master pages ?

M

Mike Dee

I posted this back in November 2005 a couple times but did not get any
responses. I'm hoping someone here can please shed some light on this.

I'm new to index server and can't get any DocTitle value back from index
server (it is returned as null) for all my aspx pages. It do get the values
from inside the <title> tags from my static .htm pages just fine.

My aspx pages however are generated from master pages where the title tag is
set dynamically at run-time. So, it seens like index server is just
indexing my raw .aspx and .cs.aspx pages instead of actually first running
the .aspx page to get its fully rendered content at runtime and then index
that resulting page.

How can I get index server to actually execute my aspx pages like a browser
would request the pages so that it can see the real, dynamically generated
content and index that, and pick up the title tag value for DocTitle?

A few of us were asking this in the index server group but no one there has
ideas. Since I assume many of you are using master pages and run into this
same thing with indexing aspx pages I thought perhaps you'd have some ideas
to share. In case it matters I am running VS.NET 2005 ASP.NET 2.0 on Win2k3
server and IIS 6. Thanks!!

--- Mike
 
H

Hilary Cotter

aspx pages are indexed using the html ifilter. It can index content it sees
within the html title tags and you can return this using the DocTitle
property. If you want it to index dynamically generated content you must
write your own ifilter and register this with the aspx extension. Another
option is to use something with will connect to your web site and generate
the rendered apsx files and store them in the file system and then have the
html iFilter index them there. You will probably have to do some resolution
back to the original apsx pages however.

--
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html

Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
 
M

Mike Dee

Hilary,

Thanks - but here's the part I'm not following... You say it can index
content it see within the html title tags. However in an ASP.NET page that
uses MasterPages, there is no hard coded title in the html. Instead there
is a Title property defined which is set in the code behind. So then I
assume this is not possible?

This is really mind boggling how something like Index Server that is
supposed to be so well coupled with IIS/ASP.NET cannot perform such a basic
function.

Certainly with the spread of ASP.NET 2 and MasterPages there must be a ton
of developers that have run into this issue. I would really like to know
how folks are going about solving this.

Thanks!

--- Mike
 
Joined
Nov 17, 2006
Messages
2
Reaction score
0
Work around for docTitle - index server - MasterPage Issue!

Okay - I found a solution to this problem, the Index Server not returning docTitle values when using MasterPages with ASP.NET. It's not pretty, it's not XHTML compliant. But here it is:

Right after your <ASP:ContentPlaceHolder> section in your .aspx page that is based off of a Master Page. Stick this chunk of HTML

<HEAD>
<TITLE>Index Server Will Pick This Up As The docTitle</TITLE>
</HEAD>

This is not valid xhtml since it's placing another HEAD section in your document - but as far as I can tell it's not hurting anything - AND IT WORKS!

If someone finds a better way - let me know!
 
Joined
Nov 17, 2006
Messages
2
Reaction score
0
Solution to having no header info in Content Page

Think I found a better way. What do you guys think?

Overriding the Master Page

You might have noticed a problem when working with your first content page. A content page lacks any form of header. It doesn't have a body tag or even provide access to the form. All that a content page contains is content. To define meta tags for your content page, you have to override the master page. Fortunately, you have an easy way to remedy this problem: the Master object.

The Master object provides access to just about everything on the master page. You can use this object to change the cache properties or work with controls on the master page directly. You can also add code to the master page that provides easy access to display elements or other features. A developer could easily change the page heading without writing a lot of code to do it.

However, of all of the Master object properties, the Page property is perhaps the most important for every day use. With this property, you can change the header or form information with relative ease. For example, you can add meta tags using the following code.

Master.Page.Header.Metadata.Add(
"title", "Index the Custom Search Pages");
This code translates into adding the standard meta tag to the header of the resulting Web page. Unfortunately, this handy addition doesn't quite do everything. To use a meta refresh tag, for example, you can't add it directly, because it relies on the http-equiv attribute shown here.

<meta http-equiv="refresh"
content="3;url=http://www.mysite.com">
However, you can add it indirectly, using the Title property. This technique leaves an extra closing </title> tag, but every browser I tested ignored it. You can use the Header property to modify the title, linked style sheet, style sheet, and any standard meta tags.

Master.Page.Header.Title =
"Meta Refresh Main Page</title>\r\n" +
"<meta http-equiv='refresh' content='4;url=Redirect.ASPX'>";
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top