I'm getting the "There can be only one 'page' directive."error message at an application that I just uploaded from my dev machine to a shared 'production' server. But here's the deal.
It goes to the login page just fine. Then it drops to default.aspx, presenting...nothing! It's supposed to "Response.Redirect("home.aspx")" But it doesn't. Then, if I point manually to home.aspx, I get:
Line 43: <%# DataBinder.Eval(Container, "DataItem.text")%>with weird spacing and all. And the line numbers are screwey anyway. None of this happened on my local dev machine.
Line 44: </a>
Line 45: <%@dotnet.itags.org. Page Language="vb" AutoEventWireup="false" Codebehind="home.aspx.vb" Inherits="MAB.home" %>
Line 46: <%@dotnet.itags.org. Register TagPrefix="uc1" TagName="MAB" src="http://pics.10026.com/?src=MAB.ascx" %>
Line 47: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" />
Anyone recognize the symptoms? I'm guessing that it's all one problem.
Thanks for reading,
Chris
Have you simply opened the aspx page and inspect the contents?
Looks like you have some funky include code going on or the like
double check for a control ( .ascx) that has a page directive in it - did you make sure the server is running the same version framework your using ?
Problem might be with page directive of control ( .ascx) .
I was thinking the same stuff y'all were.
There is one user control, it doesn't have a page directive, just the "<%@. Control Language-..." directive. I agree that it looks like messed up include, but I'm not using any includes anywhere in the app.
The lines 43 and 44 shown in the error page are exactly what I'd predict. Then it looks like it lists lines 1-3 as 45-47.
I don't know if the server is running the same framework version. Hmm. I'll look into that if you think it's a viable issue. What do I do if they're different?
Chris
So my application was developed under framework v. 1.1.4322.0 and the web host I use says "We are currently running ASP.Net 1.1 framework." How 'off' would the versions have to be to cause these kinds of problems? Anyone else have any ideas?
Chris
asp v1.1 means 1.1.4322 - so you should be OK - there are only 3 I think 1.0, 1.1, and 2.0
post your home.aspx code - might give more clues
OK, how? When I cut and paste the code in it's altered into WYSIWYG mash. Is there a trick to it?
hmmm. try putting it between [ code] tags
[ code]
put code here
[ /code]
I had to add a space to the tag so it would show up !
so thats....... bracket code bracket with no spaces
: )
If this works, it was by opening it in notepad and copy-pasting out of that instead of out of VS.
<title>home</title><%@. Page Language="vb" AutoEventWireup="false" Codebehind="home.aspx.vb" Inherits="MAB.home" %>
<%@. Register TagPrefix="uc1" TagName="MAB" src="http://pics.10026.com/?src=MAB.ascx" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" />
<HTML>
<HEAD>
<title>home</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="http://links.10026.com/?link=Styles.css" type="text/css" rel="stylesheet">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<uc1:MAB id="MAB1" runat="server" />
<div id="wrapper">
<div class="left">
<h3>Topics With Newest Entries</h3>
<div class="summary">
<asp:repeater id="rNew" runat="server">
<HeaderTemplate>
<ul>
</HeaderTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
<ItemTemplate>
<li>
<span class="bold">
<a href="http://links.10026.com/?link=topic.aspx?sub=<%# DataBinder.Eval(Container, "DataItem.topic_ID") %>">
<%# DataBinder.Eval(Container, "DataItem.topic_name").toUpper %></a></span>
</li>
</ItemTemplate>
</asp:repeater>
</div>
<h3>Newest Picture Links</h3>
<div class="summary">
<asp:Repeater ID="rPics" Runat=server>
<ItemTemplate>
<a href="http://links.10026.com/?link=topic.aspx?sub=<%# DataBinder.Eval(Container, "DataItem.topic_ID")%>">
<%# DataBinder.Eval(Container, "DataItem.text")%>
</a>
</ItemTemplate>
</asp:Repeater>
</div>
</div
<div class="right">
<h2>Editor Highlights</h2>
<div class="summary">
<asp:repeater id="rEd" runat="server">
<ItemTemplate>
<span class="bold">
<a href="http://links.10026.com/?link=topic.aspx?sub=<%# DataBinder.Eval(Container, "DataItem.topic_ID") %>">
<%# DataBinder.Eval(Container, "DataItem.topic_name").toUpper %></a>
</span>by
<%# DataBinder.Eval(Container, "DataItem.member_name") %>,
</ItemTemplate>
</asp:repeater>
</div>
</div
<div class="right">
<h2>Highest Rated</h2>
<asp:repeater id="rHigh" runat="server">
<ItemTemplate>
<div class="summary" style="background-color: #ffd;">
<div class="headline">
<span class="bold">
<a href="http://links.10026.com/?link=topic.aspx?sub=<%# DataBinder.Eval(Container, "DataItem.topic_ID") %>">
<%# DataBinder.Eval(Container, "DataItem.topic_name").toUpper %></a>
</span>by
<%# DataBinder.Eval(Container, "DataItem.member_name") %>
on
<%# DataBinder.Eval(Container, "DataItem.creation_date").ToShortDateString %>
</div>
<%# DataBinder.Eval(Container, "DataItem.text") %>
</div>
</ItemTemplate>
</asp:repeater></div>
</div>
<asp:label id="lTest" Runat="server" Font-Size="Larger" Font-Bold="True" ForeColor="#400000" />
</form>
</body>
</HTML
well - for starters
<title>home</title><@.Page Language="vb" AutoEventWireup="false" Codebehind="home.aspx.vb"Inherits="MAB.home" >
needs to be switched around
the <@.Page directive has to be first line ( I believe) and title belongs in head tags
so make that like this
<@.Page Language="vb" AutoEventWireup="false" Codebehind="home.aspx.vb"Inherits="MAB.home" >
<head>
<title>home</title>
<meta...
other head stuff.....
</head
try that and see what happens
I'm becoming kind of freaked out about this. There is no <title>home</title> in my source before the page directive. If I paste from VS, it's trying to render the HTML. I'm trying it below to compare how it looks to the above suck.
<%@. Page Language="vb" AutoEventWireup="false" Codebehind="home.aspx.vb" Inherits="MAB.home" %> <%@. Register TagPrefix="uc1" TagName="MAB" src="http://pics.10026.com/?src=MAB.ascx" %>
<META content="Microsoft Visual Studio .NET 7.1" name=GENERATOR>
<META content="Visual Basic .NET 7.1" name=CODE_LANGUAGE>
<META content=JavaScript name=vs_defaultClientScript>
<META content=http://schemas.microsoft.com/intellisense/ie5 name=vs_targetSchema><LINK href="http://links.10026.com/?link=Styles.css" type=text/css rel=stylesheet>
<FORM id=Form1 method=post runat="server"><?xml:namespace prefix = uc1 /><uc1:MAB id=MAB1 runat="server"></uc1:MAB>
<DIV id=wrapper>
<DIV class=left>
<H3>Topics With Newest Entries</H3>
<DIV class=summary><?xml:namespace prefix = asp /><asp:repeater id=rNew runat="server"><HEADERTEMPLATE></HEADERTEMPLATE></asp:repeater>
<UL><FOOTERTEMPLATE></FOOTERTEMPLATE></UL><ITEMTEMPLATE>
<LI><SPAN class=bold><A href="http://links.10026.com/?link=http://forums.asp.net/topic.aspx?sub=%3C%#%20DataBinder.Eval%28Container,%20" %="" )="" dataitem.topic_id="">"> <%# DataBinder.Eval(Container, "DataItem.topic_name").toUpper %></A></SPAN> </ITEMTEMPLATE></LI></DIV>
<H3>Newest Picture Links</H3>
<DIV class=summary><asp:Repeater id=rPics runat="server"><ITEMTEMPLATE><A href="http://links.10026.com/?link=http://forums.asp.net/topic.aspx?sub=%3C%#%20DataBinder.Eval%28Container,%20" )="" dataitem.topic_id="">"> <%# DataBinder.Eval(Container, "DataItem.text")%> </A></ITEMTEMPLATE></asp:Repeater></DIV></DIV>
<DIV class=right>
<H2>Editor Highlights</H2>
<DIV class=summary><asp:repeater id=rEd runat="server"><ITEMTEMPLATE><SPAN class=bold><A href="http://links.10026.com/?link=http://forums.asp.net/topic.aspx?sub=%3C%#%20DataBinder.Eval%28Container,%20" %="" )="" dataitem.topic_id="">"> <%# DataBinder.Eval(Container, "DataItem.topic_name").toUpper %></A> </SPAN>by <%# DataBinder.Eval(Container, "DataItem.member_name") %>, </ITEMTEMPLATE></asp:repeater></DIV></DIV>
<DIV class=right>
<H2>Highest Rated</H2><asp:repeater id=rHigh runat="server"><ITEMTEMPLATE></ITEMTEMPLATE></asp:repeater>
<DIV class=summary style="BACKGROUND-COLOR: rgb(255,255,221)">
<DIV class=headline><SPAN class=bold><A href="http://links.10026.com/?link=http://forums.asp.net/topic.aspx?sub=%3C%#%20DataBinder.Eval%28Container,%20" %="" )="" dataitem.topic_id="">"> <%# DataBinder.Eval(Container, "DataItem.topic_name").toUpper %></A> </SPAN>by <%# DataBinder.Eval(Container, "DataItem.member_name") %> on <%# DataBinder.Eval(Container, "DataItem.creation_date").ToShortDateString %> </DIV><%# DataBinder.Eval(Container, "DataItem.text") %> </DIV></DIV></DIV><asp:label id=lTest runat="server" forecolor="#400000" font-bold="True" font-size="Larger"></asp:label></FORM><BR>
post the mab.ascx and the home.vb.aspx please - they should be plain text - if not - you can paste into notepad then copy-paste.
First, thanks for all your time. Now, these are pasted from VS. When I do that, it looks terrible in the post screen, but turns out almost OK. When I paste from notepad, every tab and space shows up as a etc. So:
--
mab.ascx:
--
<%@. Control Language="vb" AutoEventWireup="false" Codebehind="MAB.ascx.vb" Inherits="MAB.MAB" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %>
Add a Topic
Editor Queue
Admin Feedback
MAB Home
OrSearch
--
home.aspx.vb
--
Imports System.Data.SqlClient
Imports System.Text.RegularExpressions
Public Class home
Inherits System.Web.UI.Page
Public Conn As New SqlConnection(ConfigurationSettings.AppSettings("conString"))
Protected WithEvents cMAB As MAB
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents rNew As System.Web.UI.WebControls.Repeater
Protected WithEvents rPics As System.Web.UI.WebControls.Repeater
Protected WithEvents rEd As System.Web.UI.WebControls.Repeater
Protected WithEvents rHigh As System.Web.UI.WebControls.Repeater
Protected WithEvents lTest As System.Web.UI.WebControls.Label
Protected WithEvents ddTopic As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents newtopic As System.Web.UI.WebControls.HyperLink
Protected WithEvents hEditorQueue As System.Web.UI.WebControls.HyperLink
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Const homeSize As Integer = 8 'number of articles per column here
Const homeLength As Integer = 200 'number of characters to display per article
Dim qs As String = "SELECT top 10 MAB_articles.article_ID, (SELECT top 1 MAB_articleIndex.topic_ID FROM MAB_articleIndex WHERE "
qs &= "MAB_articleIndex.article_ID = MAB_articles.article_ID) as topic_ID, ( SELECT top 1 topic_name FROM MAB_topics, MAB_articleIndex "
qs &= "WHERE MAB_topics.topic_ID = MAB_articleIndex.topic_ID AND MAB_articleIndex.article_ID = MAB_articles.article_ID) as topic_name "
qs &= "INTO T FROM MAB_articles ORDER BY MAB_articles.mod_date SELECT distinct topic_ID, topic_name FROM T drop table T"
Dim daNew As New SqlDataAdapter(qs, Conn)
Dim dsNew As New DataSet
Conn.Open()
daNew.Fill(dsNew, "articles")
Conn.Close()
rNew.DataSource = dsNew.Tables("articles")
rNew.DataBind()
qs = "SELECT text, (SELECT TOP 1 MAB_topics.topic_ID FROM MAB_topics, MAB_articleIndex WHERE MAB_articles.article_ID = "
qs &= "MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID ORDER BY MAB_articleIndex.topic_ID ASC) "
qs &= " as topic_ID FROM MAB_articles WHERE CONTAINS(text, '""img src=*""')"
Dim daPics As New SqlDataAdapter(qs, Conn)
Dim dsPics As New DataSet
Conn.Open()
daPics.Fill(dsPics, "images")
Conn.Close()
For i As Integer = 0 To dsPics.Tables(0).Rows.Count - 1
'regex match for images and extract image tags into the "text" column of the dataset
Dim pat As String = "<img src=.+?>"
Dim r As Regex = New Regex(pat, RegexOptions.IgnoreCase Or RegexOptions.Multiline)
Dim m As Match = r.Match(dsPics.Tables(0).Rows(i).Item("text"))
'Dim matchcount As Integer = 0
Dim newImageString As String = ""
While (m.Success)
'matchcount += 1
newImageString &= m.Value
m = m.NextMatch
End While
dsPics.Tables(0).Rows(i).Item("text") = newImageString
Next
rPics.DataSource = dsPics.Tables(0)
rPics.DataBind()
qs = "SELECT distinct top 20 (MAB_articles.rating * MAB_articles.ed_pick) as ranking, (SELECT TOP 1 MAB_topics.topic_ID FROM MAB_topics, MAB_articleIndex WHERE MAB_articles.article_ID = MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID ORDER BY MAB_articleIndex.topic_ID ASC) as topic_ID, (SELECT TOP 1 MAB_topics.topic_name FROM MAB_topics, MAB_articleIndex WHERE MAB_articles.article_ID = MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID ORDER BY MAB_articleIndex.topic_ID ASC) as topic_name, MAB_articles.creation_date, MAB_members.member_name, substring(MAB_articles.text, 1, 200) as text FROM MAB_articles, MAB_topics, MAB_articleIndex, MAB_members WHERE MAB_articles.article_ID = MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID AND MAB_members.member_ID = MAB_articles.author_ID AND MAB_articles.ed_pick > 0 ORDER BY ranking DESC"
Dim daEd As New SqlDataAdapter(qs, Conn)
Dim dsEd As New DataSet
Conn.Open()
daEd.Fill(dsEd, "articles")
Conn.Close()
For i As Integer = 0 To dsEd.Tables(0).Rows.Count - 1
dsEd.Tables("articles").Rows(i).Item(4) = deSpan(dsEd.Tables("articles").Rows(i).Item(4))
Next
rEd.DataSource = dsEd.Tables("articles")
rEd.DataBind()
qs = "SELECT distinct top 8 MAB_articles.rating, (SELECT TOP 1 MAB_topics.topic_ID FROM MAB_topics, MAB_articleIndex WHERE MAB_articles.article_ID = MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID ORDER BY MAB_articleIndex.topic_ID ASC) as topic_ID, (SELECT TOP 1 MAB_topics.topic_name FROM MAB_topics, MAB_articleIndex WHERE MAB_articles.article_ID = MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID ORDER BY MAB_articleIndex.topic_ID ASC) as topic_name, MAB_articles.creation_date, MAB_members.member_name, substring(MAB_articles.text, 1, 200) as text FROM MAB_articles, MAB_topics, MAB_articleIndex, MAB_members WHERE MAB_articles.article_ID = MAB_articleIndex.article_ID AND MAB_topics.topic_ID = MAB_articleIndex.topic_ID AND MAB_members.member_ID = MAB_articles.author_ID ORDER BY MAB_articles.rating DESC"
Dim daHigh As New SqlDataAdapter(qs, Conn)
Dim dsHigh As New DataSet
Conn.Open()
daHigh.Fill(dsHigh, "articles")
Conn.Close()
For i As Integer = 0 To dsHigh.Tables(0).Rows.Count - 1
dsHigh.Tables("articles").Rows(i).Item(4) = deSpan(dsHigh.Tables("articles").Rows(i).Item(4))
Next
rHigh.DataSource = dsHigh.Tables("articles")
rHigh.DataBind()
End Sub
Public Function deSpan(ByVal str As String) As String
Dim letterPlace As Integer = 0
Dim spanCount As Integer = 0
While letterPlace < str.Length - 6
If str.Substring(letterPlace, 6) = "<span " Then
spanCount += 1
ElseIf str.Substring(letterPlace, 6) = "</span" Then
spanCount -= 1
End If
letterPlace += 1
End While
Dim braceCount As Integer = 0
For j As Integer = 0 To str.Length - 1
If str.Chars(j) = "<" Then
braceCount += 1
ElseIf str.Chars(j) = ">" Then
braceCount -= 1
End If
Next
For k As Integer = 1 To braceCount
str &= ">"
Next
For i As Integer = 1 To spanCount
str &= "</span>"
Next
Return str
End Function
Private Sub cMAB_topicChanged(ByVal sender As Object, ByVal e As EventArgs) Handles cMAB.topicChanged
Response.Redirect("topic.aspx?sub=3")
End Sub
End Class
Chris (fingers crossed on how it turns out)
Well - I don't see anything wrong there...
You said in your first post that the default.aspx works ( which we haven't seen )
It takes you to login.aspx. From login.aspx, the user is supposed to be redirected to home.aspx
This is where it's failing right ? -Then if you manually type in home.aspx, you get the error.
can you post login aspx and it's vb code?
very weird since it works on development - I would assume its a path or security issue on production server
0 comments:
Post a Comment