Jump to content

ASP.NET and SSI


kwilliams

Recommended Posts

This is what I'm trying to setup:page1.aspx<%'Declare main form variableDim page_id As String = "login" 'Static test variable'Dim page_id As String = trim(Request.Form("page_id")) 'Dynamic variable to be used%><%'***LOGIN PAGE***If page_id = "login" Then%><!--#include virtual="login.aspx" --><%End If%>page2.aspx<%'Declare variables'Dim page_title As StringDim page_description As StringDim page_content As String'Response.Write("test") 'TEST'Page titleDim page_title As String = "Login Page"'Page descriptionpage_description = "This is the login page."'Page contentpage_content = "This the content for the login page."%>page3.aspx<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="iso-8859-1" aspcompat="true" Debug="true" %><%<%Response.Write("<title>" + page_title + "</title>")%>Resulting ErrorCompilation ErrorCompiler Error Message: BC30451: Name 'page_title' is not declared....and when I add <% Response.Write("test") %> to page2.aspx, and comment out the <% Response.Write("<title>" + page_title + "</title>") %>, I don't receive that error and the "test" does get written out. So I know that the page setup is working. I'm just not sure why the last display page (page3.aspx) is not seeing the variable from the SSI.I'm using this setup so that I can have one SSI that contains other SSI's that actually contain each page's data. I'll then pull each of the page's data using <%Dim page_id As String = trim(Request.Form("page_id"))%> on page1.aspx.If anyone could let me know what I'm doing wrong, it would be great. Thanks.

Link to comment
Share on other sites

First off if you continue down the road you are travelling you are going to realease you've wasted some time and learned some nasty coding habits.You are coding your .net pages as if they were ASP pages. this is exceptable but you will find it will limit you once you get into more complex situations.You should really look into using <script runat="server"> (inline coding) and get away from the scripting style. An even better approach would be to use VWD Express. It is free from Microsoft and will take care of compiling your code and managing your website for you. There is a link to it in my signature..net is meant to take advantage of Object Oriented Programming.It is recommended that you do not us SSI in ASP.Net because it will interfer with your objects and cause other headaches along the way.I am talking from experience here. I started using ASP.Net at work almost 2 years ago. I began coding as you are (I had a strong ASP background) because I didn't know any better. Almost 2 years later, a million headaches, we are still converting some of the code to better coding practices using VS.Net 2003.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...