473,385 Members | 1,400 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,385 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 1262
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: ...
7
by: Jibey | last post by:
Hello: I'm facing a very strange problem. When I run my Web application in Visual Studio.NET the Page_Load event is not executing. Other events like a Button_Click are executing. It doesn't...
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.