Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating an inc file in Dreamweaver

Posted on 2009-07-13
7
Medium Priority
?
488 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

618 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