Solved

Creating an inc file in Dreamweaver

Posted on 2009-07-13
7
479 Views
Last Modified: 2012-05-07
I'm trying to follow the tutorial on this  here: http://www.w3schools.com/asp/asp_incfiles.asp. My testing server is a remote Windows server.

So how do I create the .inc file? I tried just saving their Time.inc code as an inc file, but of course it doesn't work. Another option, according to the tutorial is to use asp files instead. Which would be fine except that I don't know what the full context is for their code in theTime.inc file.

Just to get my learning process going, what would the ENTIRE code be for the asp version of their time.inc code.

I know I'm all over the place here but I learn best when I see a complete example of a process right on my own computer

Thanks,
John

Here is the "time.inc" file:
 
<%
Response.Write(Time)
%>
 
What is everything that comes before and after this code?

Open in new window

0
Comment
Question by:gabrielPennyback
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 19

Expert Comment

by:daveamour
ID: 24847732
That looks fine
You include this in another page - eg Default.asp as follows
<!--#include virtual="/time.inc" -->
0
 
LVL 1

Author Comment

by:gabrielPennyback
ID: 24863873
Hi daveamour, thanks for posting but I still can't get it to work. Could you take a look at the codes for the two docs I have and let me know where I'm going wrong. Please re-post both codes with the proper corrections, otherwise I won't know exactly where in the code to place your changes.

When I preview "TimeInclude.aspx" I get this error:
Compiler Error Message: CS0103: The name 'Time' does not exist in the current context
which refers to the line: Line 10: Response.Write(Time) in "Time.aspx"

Thanks,

John


TIMEINCLUDE.ASPX
 
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
Blah, Blah .....
<p></p>
More blah, blah ...
<p></p>
<!--#include virtual="time.inc" --> 
 
</body>
</html>
 
TIME.ASPX
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
Response.Write(Time)
%>
 
</body>
</html>

Open in new window

0
 
LVL 19

Accepted Solution

by:
daveamour earned 500 total points
ID: 24866038
I see what's happening.
The tutorial you were reading is for Classic ASP but the page you have created is asp.net.
To make your asp.net page work you will need the attached.  Also your inc file will need to be:
<%
Response.Write(DateTime.Now);
%>

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="IncludeFiles._Default" %>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
Blah, Blah .....
<p></p>
More blah, blah ...
<p></p>
<!--#include virtual="time.inc" --> 
 
</body>
</html>
 
TIME.ASPX
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<%
    Response.Write(DateTime.Now);
%>
 
</body>
</html>

Open in new window

0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
LVL 1

Author Comment

by:gabrielPennyback
ID: 24866719
I feel like I'm taking you on a wild goose chase. I keep getting errors on the first line of TimeInclude.aspx. When I get rid of most of the Page definition elements causing the errors, I end up with Compiler Error Message: CS0103: The name 'Time' does not exist in the current context.
I actually don't have an aspx.cs doc or a web.config file. What would be the most minimal versions of those two files necessary for this thing to work?

Sorry for not being better prepared.

Thanks,
John
0
 
LVL 19

Expert Comment

by:daveamour
ID: 24867517
Ok depends whether you want to be using Classic ASP or asp.net?
0
 
LVL 1

Author Comment

by:gabrielPennyback
ID: 24871687
ASP.NET. Thanks :-)
0
 
LVL 1

Author Closing Comment

by:gabrielPennyback
ID: 31603041
I think I figured out how to make your solution work. Thanks,
John
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question