Is it possible to programatically change the Meta Tag HTML

R

Ross Culver

I need to be able to create a new aspx file for new users that are specific
and optimized for that user. For instance, Joe Blow clicks a button and
Joe_Blow.aspx is created.

I can create the file, no problem, by copying a template file and renaming
it. But I need to be able to change the Title, description and keywords
html tags for that new page automatically.

Is that even possible?

Thanks,

Ross
 
M

Mark Rae [MVP]

I need to be able to create a new aspx file for new users that are specific
and optimized for that user. For instance, Joe Blow clicks a button and
Joe_Blow.aspx is created.

I can create the file, no problem, by copying a template file and renaming
it. But I need to be able to change the Title, description and keywords
html tags for that new page automatically.

Is that even possible?

Several solutions...

I'd probably just use the System.IO namespace to open the newly created
file, read its contents, do a find and replace as necessary and then save
the file...
 
R

Ross Culver

Thanks, Mark. This is new to me, but I'll try it out and see how it works.

Thanks, again for the quick response.

Ross
 
G

Guest

Thanks, Mark. This is new to me, but I'll try it out and see how it works.

Thanks, again for the quick response.

Ross






- Show quoted text -

You can also consider having "url rewriting"
http://www.google.com/search?hl=en&q=url+rewriting+asp.net

This allows you to have a single page (say, a template), make a
request for Joe_Blow.aspx when it does not exist and the process that
request as you need (with unique title, description, keywords and so
on)
 
R

Ross Culver

Alexey,

This looks very interesting; but I'm not sure if its going to accomplish
what I'm after. If the pages do not already exist, then they won't get
crawled by the webbots so they're unique titles, descriptions and keywords
will be indexed by the search engines. Please, correct me if I'm wrong, but
the rewrite url routine looks like a good way to redirect a user from a
non-existent url to a dynamic one.

Thanks again, though. I'm sure this will come in handy for other scenarios.

Ross
 
G

Guest

Alexey,

This looks very interesting; but I'm not sure if its going to accomplish
what I'm after. If the pages do not already exist, then they won't get
crawled by the webbots so they're unique titles, descriptions and keywords
will be indexed by the search engines. Please, correct me if I'm wrong, but
the rewrite url routine looks like a good way to redirect a user from a
non-existent url to a dynamic one.

Thanks again, though. I'm sure this will come in handy for other scenarios.

Ross

The bot doesn't know that the page doesn't really exist, because the
response code will be 200 and not 404 (doesn't exist) or 301
(redirect). It will crawl all such links.

Look at this page
http://www.google.com/search?hl=en&q=url+rewriting+asp.net

There are few links similar to

www.aspnetworld.com/articles/2004011901.aspx
msdn2.microsoft.com/en-us/library/ms972974.aspx
weblogs.asp.net/jezell/archive/2004/03/15/90045.aspx

This is how the url rewriting works
 
R

Ross Culver

Alexey,

Ok, this would work if the querystring parameter I was passing to the aspx
page was descriptive, for instance,
http://www.domain.com/basicpage.aspx?doctor=doctorname.
But I'm passing an integer value, the doctor's id number, like
http://www.domain.com/basicpage.aspx?docid=15248, which has no optimization
value (no one is search for '15248', they're searching for 'Dr. Bill'. I
can't really use the doctor's name as the parameter because of the
possibility of several doctors with the same name. If I'm missing
something, please let me know.

Thanks, again.

Ross
 
R

Ross Culver

Mark,

I was able to create the file and even write back to the html using the
streamwriter and the replace() function. I placed the write procedure
within an if statement that checked for the existence of the original phrase
and even though the procedure ran without error, it didn't replace the
string. Then I looked further down on the page, several lines down in the
body, and saw that it wrote my replacement string down there where the
original phrase was not.

I'm so close, but do you know why it wrote where it did? Below is a snippet
of the code. Note that I'm really only checking the first line of the page.
Dim FS As FileStream, LineText As String = Nothing
FS = New FileStream(FileName, FileMode.Open,
FileAccess.ReadWrite, FileShare.ReadWrite)

Dim SR As New StreamReader(FS) ', SW As New StreamWriter(FS)

Dim itm As String = SR.ReadLine

While Not itm = Nothing

If Microsoft.VisualBasic.InStr(itm, "Full_Listing") > 0 Then

Dim SW As New StreamWriter(FS)

SW.WriteLine(Microsoft.VisualBasic.Replace(itm,
"Full_Listing", "Natarajan_Asokan"))

SW.Close()

Me.labMsg.Text = "Updated!"

Else

Me.labMsg.Text = "Didn't find it"

End If

X = X + 1

If X = 1 Then Exit While

End While

SR.Close()

FS.Close()

Thanks, again, for the assistance.

Ross
 
M

Mark Rae [MVP]

Thanks, again, for the assistance.

That's not actually what I suggested... ;-)

1) Open the "template" file

2) Read its entire contents into a string variable

3) Close the template file

4) Do the find and replace as necessary on the string variable

5) Create a new file and write the entire contents of the string variable
into it

6) Save the new file
 
G

Guest

Alexey,

Ok, this would work if the querystring parameter I was passing to the aspx
page was descriptive, for instance,http://www.domain.com/basicpage.aspx?doctor=doctorname.
But I'm passing an integer value, the doctor's id number, likehttp://www.domain.com/basicpage.aspx?docid=15248, which has no optimization
value (no one is search for '15248', they're searching for 'Dr. Bill'. I
can't really use the doctor's name as the parameter because of the
possibility of several doctors with the same name. If I'm missing
something, please let me know.

When you wanted to save Joe_Blow.aspx as a file how to do you deal
with the case when there are two doctors with the same name? If I were
you I would rewrite this as .../Doctors/15248/Joe_Blow.aspx with the
id and the name in the url or simply ../Doctors/15248.aspx. The id
will be used to call a database, the name is just for a webbot (even
it has not very big meaning for SEO)
 
R

Ross Culver

That's exactly what I did and it worked great! I was able to create over
100,000 aspx pages with individual unique title, description and keyword
meta tags in less than 30 minutes! And since the actual data, images and
maps on each are dynamic and based off an ID which I updated in the string
variable before creating the new file, every single page is uniquely
different and specific!

Thanks a million, Mark.
 

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

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top