Started New Blog Services Ahmedabad Live News
Started another New Blog Services MoonEyes Cars

Wednesday, January 12, 2011

Meta tag not works in asp.net

I found one bug in asp.net which is basically if you have protected variable and you want to use this variable in .aspx page then you may easily use

Example :
dim strTemp as Protected
In page load event wrote
strTemp="Hello"

Now in .aspx page you can print "Hello" by write <%=strTemp%>

But when you want to write same thing in meta tag then we wrote



Above code is not work properly for that you need to write below code

Dim head As HtmlHead = CType(Page.Header, HtmlHead)
Dim KeywordMeta As HtmlMeta = New HtmlMeta()
KeywordMeta.Attributes.Add("Name", "keywords")
KeywordMeta.Attributes.Add("Content", "String with keywords")
head.Controls.Add(KeywordMeta)

No comments: