?
Solved

Creating an inc file in Dreamweaver

Posted on 2009-07-13
7
Medium Priority
?
482 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 2000 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
Technology Partners: 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!

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses
Course of the Month8 days, 14 hours left to enroll

764 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