473,706 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP.NET meta head

GTi
When i Use
HtmlHead head.Title
I can change the <title> of a webpage from codebehind.
But I need to add <meta>, <link href=> an <script src=> also from
codebehind.

Nov 29 '05 #1
2 1217
For script blocks u can use Page.RegisterSt artupScript.. for link href u may
prefer asp style construction. For instance, MyVariable must be (at least)
protected variable/property...

<link href="<%=MyVari able%>"

But it is not recommended.. Try to remove your dependencies. Codebehind is
to remove this tightly coupled connections between Design and
Implementation. ..
--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

"GTi" <tu****@gmail.c om> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
When i Use
HtmlHead head.Title
I can change the <title> of a webpage from codebehind.
But I need to add <meta>, <link href=> an <script src=> also from
codebehind.

Nov 29 '05 #2
There's a new HtmlLink class that writes the link element into the head but
there does not appear to be an equivalent for writing a script element into
the head. I'm using this...

#region Write JavaScript <script> Element External File Reference...

// Define an arbitrary but unique name to use as a key
String key = "ExternalJavaSc riptReference";
String url = Request.Applica tionPath + "/Scripts/scripts.js";

// Instantiate ClientScript object
ClientScriptMan ager cs = Page.ClientScri pt;

// Do not register if this instance of the key is already registered
already.
if (!cs.IsClientSc riptIncludeRegi stered(key))
{
// Write <script> element into body of the page
cs.RegisterClie ntScriptInclude (key, url);
}
#endregion

That writes the <script> element into the body and as far as I can tell
provides the same functionality as it were in the head noting I'd like to
know the difference if any.
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Information Service"
NET csgallagher AT metromilwaukee. com
URL http://metromilwaukee.com/
URL http://clintongallagher.metromilwaukee.com/


"Yunus Emre ALPÖZEN [MCSD.NET]" <yemre> wrote in message
news:Oo******** *******@TK2MSFT NGP15.phx.gbl.. .
For script blocks u can use Page.RegisterSt artupScript.. for link href u
may prefer asp style construction. For instance, MyVariable must be (at
least) protected variable/property...

<link href="<%=MyVari able%>"

But it is not recommended.. Try to remove your dependencies. Codebehind is
to remove this tightly coupled connections between Design and
Implementation. ..
--
HTH

Thanks,
Yunus Emre ALPÖZEN
BSc, MCSD.NET

"GTi" <tu****@gmail.c om> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
When i Use
HtmlHead head.Title
I can change the <title> of a webpage from codebehind.
But I need to add <meta>, <link href=> an <script src=> also from
codebehind.


Nov 29 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2611
by: Darren Blackley | last post by:
Hi there I have documents that I want to automatically add additional meta tags to. The documents already have some meta tags and I want to keep them all together, so I want to add my new meta tags to the end of the existing ones... can someone help me out with a script to do this... example below. <head> <title>The Document Title</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="discription"...
3
32906
by: J1C | last post by:
How can I programatically add meta tags with javascript?
5
12094
by: RodneyDunes | last post by:
My site did validate and now it doesn't. The error I get is the following: document type does not allow element "META" here ....nt-type" content="text/html;charset=iso-8859-1"> Can someone please tell me what I need to change?These are the Meta tags: </head> <meta http-equiv="Content-type" content="text/html;charset=iso-8859-1"> <META http-equiv="PICS-Label" content=(PICS-1.1 "http://www.classify.org/safesurf/" L gen true for
2
5642
by: localhost | last post by:
I have these in all of my pages: <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#"> <meta name=vs_defaultClientScript content="JavaScript"> <meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5"> And I am wondering if it is safe to remove them after I compile the ASP.NET application, or if it is possible to have VS.NET 2003 not put
1
1956
by: Maziar Aflatoun | last post by:
Hi everyone, My goal is to modify the contents of my meta tag (html refresh). However, my code adds a new instance of the meta tag at the bottom of the page. Is there a way to modify it instead of adding a new one? <head> <title>WebForm1</title> <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE" Content="C#">
4
2299
by: clintonG | last post by:
Anybody know how to dynamically write the meta tags using code so they are formatted on a separate line in the HTML source? Preferred or optimal framework classes that may be used in this regard? <meta... /> <meta... /> <meta... /> <%= Clinton Gallagher
6
4741
by: Fred Nelson | last post by:
Hi: I'm developing a new C# Web App and I'm hoping to find a way that I can dynamically generate meta tags for the search engines at the page level. (I want to do this so that I can have someone update a database with the appropriate tags - since we cache our pages this won't be a performance problem). I am using a master pages so I will need a way to update each page that we decide should have tags.
1
2372
by: joeblast | last post by:
Can someone explain to me why the META Refresh doesn't work in an ASP.NET page? It works just fine in my old asp one! Content value has to be in quotes if not otherwise I get a warning. Thanks DOTNET -------------------- <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb"
3
2083
by: Rick | last post by:
I have a base class that inherits from System.Web.UI.Page that I need to include the ability to read the inheriting class/page meta tags. I can't find any methods in the System.Web.UI.Page members that provide access to do this. What is the practice to read meta information from the head section of an ASP.NET page? I am using VS.NET 1.1 C# (VB is fine).
2
1504
by: Bill Nguyen | last post by:
The HTML doc looks like this: <HTML xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office"> <HEAD> <META NAME="Generator" CONTENT="Microsoft MapPoint 2004">
0
9287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9157
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8999
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7912
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5939
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4710
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3150
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2096
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.