By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

Dynamic page title in AP

P: 23
Is it possible to have dynamic page titles with an ASP site? Many people would like to share our content on facebook, but can't do so because the page titles are displayed as the URL.

I'm not very familiar with ASP, so any help would be greatly appreciated.
Aug 23 '11 #1
Share this Question
Share on Google+
3 Replies

Expert 2.5K+
P: 3,405

With ASP your script creates the code of the web page. Not just the text of the web page, but the underlying code as well. so it is easy to say
Expand|Select|Wrap|Line Numbers
  1. if session(var1) = "current" then
  2.    response.write "<title>A nifty web page</title>" & vbNewLine
  3. else
  4.    response.write "<title>An ordinary web page</title>" & vbNewLine
  5. end if 
  7. 'or
  9. <title><%=userName%>'s home page</title>
Let me know if this answers your question.

Aug 29 '11 #2

P: 23
Expand|Select|Wrap|Line Numbers
  1. <title><%=userName%>'s home page</title>
I am not too familiar with ASP/Microsoft SQL. What should I be looking to replace the userName variable with? Can I use a variable from the database to plug in here?
Aug 29 '11 #3

Expert 2.5K+
P: 3,405
yes, that would work. Using database fields it would look something like this
Expand|Select|Wrap|Line Numbers
  1. <title><%=rs("fname") & " " & rs("lname")%>'s home page</title>
the code <%= %> just prints out the value of whatever variable you put in there.

At this point, it sounds like there are still several missing pieces of information between you and your final solution, and it is hard for me to see what you are still missing. You might want to check out, they have a fairly broad library of tutorials and examples. Of course you can keep firing your questions at me and I will continue to help answering them.

Aug 29 '11 #4

Post your reply

Sign in to post your reply or Sign up for a free account.