Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 27th, 2005, 10:42 AM
Authorized User
 
Join Date: May 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using Include statements in ASP.NET

I have a Utilities.vb page that contains a number of classes (not compiled) being referenced by a number of (in-line coded) aspx pages.

Since I'm not too familiar with either ASP or ASP.NET, I was wondering if the statement used extensively in ASP classic:
Code:
Code:

would still apply in .NET in this context.

This application was not created using a Visual Studio Project, and the above referenced Include statement doesn't work as the server keeps returning:

Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

BC30002: Type 'Utilities.DPAPI' is not defined.

etc. etc.........

 
Old June 27th, 2005, 01:58 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

You cannot use include files as far as I know in ASP.Net. You can convert it to a vb class file and use that in your aspx pages.

 
Old June 27th, 2005, 02:13 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

As Jim has pointed out, non-precompiled ASP.NET can not take advantage of supporting classes. You'll need to compile at least those support/utility classes into an assembly that is accessible by the pages.

-Peter
 
Old June 28th, 2005, 08:36 AM
Authorized User
 
Join Date: May 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Jim, Peter,

Thank you for the replies. You were right, and I found at least two ways of solving this issue:

+ I could use the script tag, and specify the source file in the src attribute:
Code:
<script runat="server" language="vb" src="Utilities.vb" />
+ I could use the Assembly directive in the web page to point to the code file:
Code:
<%@ Assembly Name="MyWebApp" %>
<%@ Assembly Src="Utilities.vb" %>
Thanks again,

b-d






Similar Threads
Thread Thread Starter Forum Replies Last Post
Can i use asp within sql statements knight Classic ASP Databases 43 May 24th, 2007 09:32 AM
include style in asp.net Magen ASP.NET 1.0 and 1.1 Basics 3 February 26th, 2007 07:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.