Problem with empty page

J

Jeff

hi

asp.net 3.5

I have a webpage which if it has a querystring attached it'll display some
usefull information. But if no querystring is attached it displays this
content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252"
http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>

I've tryed to put some logic into the page so when no querystring is used it
should give some values to a Literal control on the page. That code executes
but new value of the Literal isn't visible on the page. In addition this
page also have a masterpage, the html of the masterpage is not sent to the
browser if page have no querystring.

I was hoping to be able to add a noindex tag to the header if the page has
no querystring, so far no luck. Code is executed but the tag never appear in
the head section

HtmlHead header = this.Page.Header;
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "robots";
keyword.Content = "noindex, nofollow";
header.Controls.Add(keyword);

Think this is bad for google ranking, googlebot tryes to index the page (it
crawl the page without using querystring) and find nothing, wants to improve
this

any suggestions?
 
G

Guest

hi

asp.net 3.5

I have a webpage which if it has a querystring attached it'll display some
usefull information. But if no querystring is attached it displays this
content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252"
http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>

I've tryed to put some logic into the page so when no querystring is used it
should give some values to a Literal control on the page. That code executes
but new value of the Literal isn't visible on the page. In addition this
page also have a masterpage, the html of the masterpage is not sent to the
browser if page have no querystring.

I was hoping to be able to add a noindex tag to the header if the page has
no querystring, so far no luck. Code is executed but the tag never appear in
the head section

HtmlHead header = this.Page.Header;
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "robots";
keyword.Content = "noindex, nofollow";
header.Controls.Add(keyword);

Think this is bad for google ranking, googlebot tryes to index the page (it
crawl the page without using querystring) and find nothing, wants to improve
this

any suggestions?

Where do you execute it, in the master? Are you sure that it is
executed? Check the code where you check if no querystring is
specified, maybe it never happens...
 
J

Jeff

hi

asp.net 3.5

I have a webpage which if it has a querystring attached it'll display some
usefull information. But if no querystring is attached it displays this
content:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=windows-1252"
http-equiv=Content-Type></HEAD>
<BODY></BODY></HTML>

I've tryed to put some logic into the page so when no querystring is used
it
should give some values to a Literal control on the page. That code
executes
but new value of the Literal isn't visible on the page. In addition this
page also have a masterpage, the html of the masterpage is not sent to the
browser if page have no querystring.

I was hoping to be able to add a noindex tag to the header if the page has
no querystring, so far no luck. Code is executed but the tag never appear
in
the head section

HtmlHead header = this.Page.Header;
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "robots";
keyword.Content = "noindex, nofollow";
header.Controls.Add(keyword);

Think this is bad for google ranking, googlebot tryes to index the page
(it
crawl the page without using querystring) and find nothing, wants to
improve
this

any suggestions?

Where do you execute it, in the master? Are you sure that it is
executed? Check the code where you check if no querystring is
specified, maybe it never happens...


I execute it in the page (not master), and I know the code is executed
because I have a breakpoint there which is triggered
 
G

Guest

Where do you execute it, in the master? Are you sure that it is
executed? Check the code where you check if no querystring is
specified, maybe it never happens...

I execute it in the page (not master), and I know the code is executed
because I have a breakpoint there which is triggered

Jeff,

I've tested what you said and I get "noindex, nofollow" as expected

Here's what I have

ContentPage:
-----------------------------

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"
AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WCM.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
</asp:Content>

Codebehind

public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HtmlHead header = this.Page.Header;
HtmlMeta keyword = new HtmlMeta();
keyword.Name = "robots";
keyword.Content = "noindex, nofollow";
header.Controls.Add(keyword);
}
}


Master:
-------------------------
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Site1.master.cs" Inherits="WCM.Site1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

The result page has

<meta name="robots" content="noindex, nofollow" />

Hope this helps
 

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,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top