asp.net code not displaying results

K

Kevin Hanken

Hi,

Pretty much a newbie to aspnet and xp -- I am using XP Pro, Service Pack 2.

I installed IIS, set up a virtual directory, created an aspx file and pasted
in a little code from the w3schools site and then tried viewing the page
using my localhost.

The aspx page loads, but the little aspnet script asking to write the NOW
function -- won't display. Since I copied it from w3schools, I am assuming
it is syntactically correct.

Before sending this off -- I just saved the file as an ASP file and tried
displaying it -- and it works.

Can anyone clarify where my grief is?

thanks,
Kevin
 
M

Marina Levit [MVP]

The script you took - is it an ASP script. or an ASP.NET script?

I suspect it is an ASP script, which means it won't necessarily work in
ASP.NET, since ASP.NET has a different syntax, different set of libraries,
etc.

I would forget trying to copy things off the web, and start off with
learning the basics about .NET and ASP.NET, and starting off slowly before
jumping right in.
 
K

Kevin

Well, i am not sure how much more basic I can get. Here is the complex code
I copied and pasted --

<%Response.Write(now())%>

and the w3schools site sez it it is asp.net compatibile -- and in fact they
provide a link to display this powerful piece of code -- and it displays.

So thanks for your help.
 
J

Juan T. Llibre

Did you install either the 1.1 or the 2.0 .Net Framework ?

That code won't run unless the .Net Framework is installed.


You can download the free .Net Framework 2.0 redistributable at :
http://www.microsoft.com/downloads/...cb-4362-4b0d-8edd-aab15c5e04f5&DisplayLang=en

And you can download, free, the .Net Framework 2.0 SDK at :
http://www.microsoft.com/downloads/...99-B7B4-4F47-A244-C96D69C35DEC&displaylang=en

If you install 2.0, you can use the free VWD Express 2005 to write your apps:
http://msdn.microsoft.com/vstudio/express/vwd/

If you want to start with 1.1, the redistributable is here :
http://www.microsoft.com/downloads/...E3-F589-4842-8157-034D1E7CF3A3&displaylang=en

And the SDK is here :
http://www.microsoft.com/downloads/...a6-3647-4070-9f41-a333c6b9181d&displaylang=en

If you install 1.1, make sure you also install the .Net Framework's SP1 :
http://www.microsoft.com/downloads/...4F-088E-40B2-BBDB-A83353618B38&displaylang=en

....and the Security Update for SP1 :
http://www.microsoft.com/downloads/...8A-29EB-49CF-9DBC-1A0DC2273FF9&displaylang=en

You can't develop for the 1.1 Framework with Visual Web Developer Express 2005, though.
 
M

Marina Levit [MVP]

I think NOW is a throwback to VB6, which is in the Microsoft.VisualBasic
namespace. It's not in the core framework namespace which all start with
System.

You should use DateTime.Now if you want to get the current date/time. Call
the ToString method on it, to get it in string format for Response.Write.

You should avoid using all those old functions in generals, there is always
a way to do it that is more portable across languages. For example, C#
wouldn't reference Microsoft.VisualBasic by default.

If there are no syntax errors on the ASP.NET page, then I would assume that
NOW is supported just fine there, so I would make sure the ASP.NET is
properly installed, etc.

Call Response.Write and give it "test" as the argument. If you still see
blank, the problem would with the configuration of ASP.NET.
 
J

Juan T. Llibre

re:
I think NOW is a throwback to VB6, which is in the Microsoft.VisualBasic namespace. It's not in the
core framework namespace which all start with System.

<%Response.Write(now())%> should compile without importing Microsoft.VisualBasic.

See a working example at : http://asp.net.do/test/DateTime.aspx

I don't think Kevin installed a .Net Framework version at all,
or if he did install it, he's got a bad install.




Marina Levit said:
I think NOW is a throwback to VB6, which is in the Microsoft.VisualBasic namespace. It's not in the
core framework namespace which all start with System.

You should use DateTime.Now if you want to get the current date/time. Call the ToString method on
it, to get it in string format for Response.Write.

You should avoid using all those old functions in generals, there is always a way to do it that is
more portable across languages. For example, C# wouldn't reference Microsoft.VisualBasic by
default.

If there are no syntax errors on the ASP.NET page, then I would assume that NOW is supported just
fine there, so I would make sure the ASP.NET is properly installed, etc.

Call Response.Write and give it "test" as the argument. If you still see blank, the problem would
with the configuration of ASP.NET.
 
M

Marina Levit [MVP]

Right, I didn't say it shouldn't work. I pointed out that using those
functions isn't a good idea to begin with. This was just a comment with
regards to my opinion on good coding practices.

I ended my post with a recommendation at looking into making sure that
ASP.NET is property installed and configured.
 
J

Juan T. Llibre

Cool.

Just wanted to make sure we're on the same page.




Marina Levit said:
Right, I didn't say it shouldn't work. I pointed out that using those functions isn't a good idea
to begin with. This was just a comment with regards to my opinion on good coding practices.

I ended my post with a recommendation at looking into making sure that ASP.NET is property
installed and configured.
 
K

Kevin

thanks everyone.

I searched google for info on how to determine if the framework is
installed -- and the page I located had me check the registry. By all
indications, I do have it installed -- atleast here is the reg key it
referenced:

HKEY_LOCAL_MACHINE/SOFTWARE/
MICROSOFT/.NETFramework/policy/v1.1

the 4322 key has a value of 3706-4322

Is there a way to determine a bad install or should I just look to
reinstall? And if you were me, would you go to the 2.0 ver.?

thanks again everyone.




I will look into uninstalling and reinstalling.
 
K

Kevin

Thanks for the advice. I will definitely keep it in mind.

Right now all I really am trying to do is make sure I am able to use this xp
machine to develop asp.net pages.

I have a 2000 machine at home and had no problems setting it up to do so. I
just took a new job and everything is xp, so I am trying to adjust and am
attempting to move from asp classic to the dotnet world.

Thanks Marina.
 
K

Kevin

Juan, if it were a bad install, would my browser recognize and then dispaly
a file with an aspx extension?

Because the file displays and shows the html -- it just won't show the asp
code -- and like I said, the very same page works fine with an .asp
extension.

thanks
 
J

Juan T. Llibre

Hi, Kevin.

You may have it installed...but not registered.

Open a command window at :
Drive:\WINDOWS\Microsoft.NET\Framework\v1.1.4322

and run the following command :

aspnet_regiis -i

That should get the .Net Framework up and running.
 
J

Juan T. Llibre

Hi, Kevin.

I just answered an earlier reply of yours, but here it is again just in case.

You may have it installed...but not registered with IIS.

Open a command window at :
Drive:\WINDOWS\Microsoft.NET\Framework\v1.1.4322

and run the following command :

aspnet_regiis -i

That should get the .Net Framework registered with IIS...and up and running.
 
K

Kevin

you Da Man, Juan.

Thank you very much.


Juan T. Llibre said:
Hi, Kevin.

You may have it installed...but not registered.

Open a command window at :
Drive:\WINDOWS\Microsoft.NET\Framework\v1.1.4322

and run the following command :

aspnet_regiis -i

That should get the .Net Framework up and running.
 
J

Juan T. Llibre

You're very much welcome, Kevin!

Glad you're up and running...

re:
if you were me, would you go to the 2.0 ver.?

You can safely install the .Net Framework 2.0 side-by-side with the 1.1 version.
You can program for both Frameworks on the same box.

Use the links I sent you today in the message sent at : Thu, 17 Aug 2006 14:48:13 -0400
and download/install at least the redistributable and the free IDE (VWD ).

Later you should install the SDK, because it installs the 2.0 QuickStart Tutorial,
which you can use to jumpstart your 2.0 skills.

See an online version of the QuickStart Tutorial at :
http://asp.net/quickstart/aspnet/Default.aspx

You'll enjoy learning about, and programming, ASP.NET!
 
K

Kevin

Thanks Juan. I really appreciate you getting me quickstarted like this. I'm
diving right in.

take care.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top