Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Is it possible to programatically change the Meta Tag HTML

Reply
Thread Tools

Is it possible to programatically change the Meta Tag HTML

 
 
Ross Culver
Guest
Posts: n/a
 
      08-27-2007
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


 
Reply With Quote
 
 
 
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      08-27-2007
"Ross Culver" <> wrote in message
news:...

>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...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
 
 
 
Ross Culver
Guest
Posts: n/a
 
      08-27-2007
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


"Mark Rae [MVP]" <> wrote in message
news:...
> "Ross Culver" <> wrote in message
> news:...
>
>>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...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-27-2007
On Aug 27, 5:16 pm, "Ross Culver" <rcul...@warrenalloy.com> wrote:
> 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
>
> "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote in messagenews:. ..
>
>
>
> > "Ross Culver" <rcul...@warrenalloy.com> wrote in message
> >news:...

>
> >>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...

>
> > --
> > Mark Rae
> > ASP.NET MVP
> >http://www.markrae.net- Hide quoted text -

>
> - Show quoted text -


You can also consider having "url rewriting"
http://www.google.com/search?hl=en&q...riting+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)

 
Reply With Quote
 
Ross Culver
Guest
Posts: n/a
 
      08-27-2007
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


"Alexey Smirnov" <> wrote in message
news: ps.com...
> On Aug 27, 5:16 pm, "Ross Culver" <rcul...@warrenalloy.com> wrote:
>> 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
>>
>> "Mark Rae [MVP]" <m...@markNOSPAMrae.net> wrote in
>> messagenews:. ..
>>
>>
>>
>> > "Ross Culver" <rcul...@warrenalloy.com> wrote in message
>> >news:...

>>
>> >>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...

>>
>> > --
>> > Mark Rae
>> > ASP.NET MVP
>> >http://www.markrae.net- Hide quoted text -

>>
>> - Show quoted text -

>
> You can also consider having "url rewriting"
> http://www.google.com/search?hl=en&q...riting+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)
>



 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-27-2007
On Aug 27, 11:55 pm, "Ross Culver" <rcul...@warrenalloy.com> wrote:
> 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...riting+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

 
Reply With Quote
 
Ross Culver
Guest
Posts: n/a
 
      08-28-2007
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

"Alexey Smirnov" <> wrote in message
news: ups.com...
> On Aug 27, 11:55 pm, "Ross Culver" <rcul...@warrenalloy.com> wrote:
>> 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...riting+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
>



 
Reply With Quote
 
Ross Culver
Guest
Posts: n/a
 
      08-28-2007
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


"Mark Rae [MVP]" <> wrote in message
news:...
> "Ross Culver" <> wrote in message
> news:...
>
>>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...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net



 
Reply With Quote
 
Mark Rae [MVP]
Guest
Posts: n/a
 
      08-28-2007
"Ross Culver" <> wrote in message
news:...

> 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


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      08-28-2007
On Aug 28, 4:06 pm, "Ross Culver" <rcul...@warrenalloy.com> wrote:
> 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)

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML.Tag.BASE same as HTML.Tag.A carlbernardi@gmail.com Java 1 11-29-2006 03:41 AM
How to get meta:resourcekey programatically? LM ASP .Net 1 03-01-2006 04:01 PM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
change meta tag description in all htm documents including all files in subdirectories Tamara Perl Misc 2 04-07-2004 01:15 PM
how do I dynamically change an html meta tag from my code behind code? ntm ASP .Net 2 01-19-2004 05:00 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57