Solved

Creating an inc file in Dreamweaver

Posted on 2009-07-13
7
453 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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 …
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now