473,406 Members | 2,345 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Executing a var within an aspx .inc file?

CES
All,
How do you write out a variable in a ASPX .inc?? I've used the following in
my code and it worked until I changed the date & MyWebSite, to a server side
write... is there any way of getting this to work within an inc file
structure? Thanks in advance. - CES
<%
Response.WriteFile("Yourfile.FileExtension");
%>
----- Yourfile.FileExtension ------
<div id="copyright">
Copyright <%=DateTime.Now.Year.ToString()%- <%=MyWebSite%- All rights
reserved.
<br />Use of this site signifies the users complete agreement to all terms,
contained
<br />&amp; described within the Terms of Use page (Updated July 31, 2008)
</div>
Aug 28 '08 #1
4 1961
Why create include files in ASPX. It is much easier to derive from the Page
class and have your pages derive from that class. You can then have
something the same in every page that needs it.

There are other ways to set up global FUD, of course. I am not sure #Include
is my first option. It is probably my last.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"CES" <ce*@noemaill.comwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
All,
How do you write out a variable in a ASPX .inc?? I've used the following
in my code and it worked until I changed the date & MyWebSite, to a server
side write... is there any way of getting this to work within an inc file
structure? Thanks in advance. - CES
<%
Response.WriteFile("Yourfile.FileExtension");
%>
----- Yourfile.FileExtension ------
<div id="copyright">
Copyright <%=DateTime.Now.Year.ToString()%- <%=MyWebSite%- All rights
reserved.
<br />Use of this site signifies the users complete agreement to all
terms, contained
<br />&amp; described within the Terms of Use page (Updated July 31, 2008)
</div>

Aug 28 '08 #2
CES
Thanks for not answering my question... I'm just switch over to .net from
classic asp and as much as possible I'm trying to take small steps with
concepts I've used in the past and what you just stated doesn't mean
anything to me... yet!
"Cowboy (Gregory A. Beamer)" <No************@comcast.netNoSpamMwrote in
message news:ee**************@TK2MSFTNGP02.phx.gbl...
Why create include files in ASPX. It is much easier to derive from the
Page class and have your pages derive from that class. You can then have
something the same in every page that needs it.

There are other ways to set up global FUD, of course. I am not sure
#Include is my first option. It is probably my last.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************
"CES" <ce*@noemaill.comwrote in message
news:Om**************@TK2MSFTNGP02.phx.gbl...
>All,
How do you write out a variable in a ASPX .inc?? I've used the following
in my code and it worked until I changed the date & MyWebSite, to a
server side write... is there any way of getting this to work within an
inc file structure? Thanks in advance. - CES
<%
Response.WriteFile("Yourfile.FileExtension");
%>
----- Yourfile.FileExtension ------
<div id="copyright">
Copyright <%=DateTime.Now.Year.ToString()%- <%=MyWebSite%- All
rights reserved.
<br />Use of this site signifies the users complete agreement to all
terms, contained
<br />&amp; described within the Terms of Use page (Updated July 31,
2008)
</div>

Aug 28 '08 #3
"CES" <ce*@noemaill.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Thanks for not answering my question...
- I'd say he did.
I'm just switch over to .net from classic asp and as much as possible I'm
trying to take small steps with concepts I've used in the past
- Maybe that is your problem
and what you just stated doesn't mean anything to me... yet!
- So it is Gregorys fault you don't understand? Hmm..

//Michael Starberg
Aug 31 '08 #4

"CES" <ce*@noemaill.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Thanks for not answering my question...
I did answer your question. You did not give me a context to go from, so I
made an incorrect assumption.
>I'm just switch over to .net from classic asp and as much as possible I'm
trying to take small steps with concepts I've used in the past and what you
just stated doesn't mean anything to me... yet!
Now I have a context.

ASP is inline coded. It is interpreted one line at a time. ASP.NET is
compiled. This is your first paradigm shift.

You can do

<%
//code here
%>

in ASP.NET, but it is not advised. You are better to bind than to write out
stuff.

For example, you want a copyright date. Here is your old code:

<div id="copyright">
Copyright <%=DateTime.Now.Year.ToString()%- <%=MyWebSite%- All rights
reserved.
<br />Use of this site signifies the users complete agreement to all terms,
contained
<br />&amp; described within the Terms of Use page (Updated July 31, 2008)
</div>

To do this in .NET, you have three choices:

1. Use a class derived from page
2. Use a master page
3. User a control

The master page is probably the best option, if this is all you are doing,
but it is not something you can do to a page without altering it quite a
bit. With the class option, you can pull your ASP tags and with minor
alteration have the page running (it may not do everything the ASP does, but
it will display the copyright).

The user control encapsulates the logic, but you will have to drag it on
every page, which is why the master is so important.

Which of the options you ultimately chose depends on where you want to go.
The best replacement for .inc is a derived class. The best option, long
term, is a master page. If you feel you might use this in multiple sites, a
user control (or even a compiled server control) may be a better option.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://feeds.feedburner.com/GregoryBeamer#

or just read it:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

Sep 2 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Brad Pears | last post by:
Can someone give me some sample code on how one would go about executing a command line "command" from within an ASP form? We need to run an application called GnuPG which allows us to encrypt an...
3
by: Daniel Groh | last post by:
Hi, I've written a C# Server.Transfer from WebForm1.aspx to WebForm2.aspx In both i'm using the same user control but with different params, for example; In the user control: ...
9
by: Hasani \(remove nospam from address\) | last post by:
I have a website with 2 aspx pages Foo.aspx, and bar.aspx The content of both files is //in 1 file Hello <%=Session.ToString()%> ================
0
by: John A Grandy | last post by:
I solved this problem once before ... but I've forgotten exactly how I solved it ... Directly beneath my web-app root-folder, I have a two sub-folders, Folder1 and Folder2. Folder1 contains...
0
by: Roshawn Dawson | last post by:
Hi, I have a web application that has various sub directories. Here is what it looks like: MyApp/default.aspx MyApp/Author/default.aspx MyApp/xslt/books.xsl
1
by: EagleRed | last post by:
I am developing an ASP.NET 2.0 application using a master page. I have a DataList control on the master page that has a datasource this is an ArrayList of objects that have a CmdURL property. ...
11
by: simon | last post by:
Hello, I'm helping write a .net app, we are using VS2005 and asp/vb.net for code we are using the "masterPage.master" technique, within the masterpage we have an asp:contentplaceholder that is...
7
by: tshad | last post by:
I thought I understood how the SaveViewState is working and was trying to use this (as per some code I found) to detect refreshes. It seemed to be working but I found that the SaveViewState was...
4
by: CES | last post by:
All, How do you write out a variable in a ASPX .inc?? I've used the following in my code and it worked until I changed the date & MyWebSite, to a server side write... is there any way of getting...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.