Monday, March 26, 2012

Newbie ASP.NET Testing probles

OK I'm a complete beginner, and I've hit a snag.
I'm using Dreamweaver to create my ASP.NET pages, and i'm testing on my pc.
I have
XP Pro (Service Pack 2)
.NET Framework 1.1
IIS
and I'm using VB as my language
The problem is when i create my pages (that are stored in the wwwroot folder in inetpub) they do not run the ASP.NET VB code. I do not get errors it just shows some of the text but not the bits that should be generated by the VB and when I view the source code it says exactly what i have typed in my page. Not the HTML page that should be created with ASP.NET VB?, hiding the code you have written.
An example of this is this page.
<%@dotnet.itags.org.Page Language="VB" Debug="True" Explicit="True" %>
<html>
<head>
<title>Date</title>
</head>
<body>
<%
Dim CurrentDate As String
CurrentDate = Today
%>
The Current Date is <%=CurrentDate %>.<br>
</body>
</html>
Which produces the following result
The Current Date is .
My preview page in Dreamweaver says.
The Current Date is {text}.
Has anyone got any ideas please. Do I need to tweak the settings of IIS or do I need to install something into my inetpub?
Any help would be great guys thanks.

I don't use the inline method, which you're trying to use here...but itappears you're missing <script> tags. You should have alook at the tutorials on this site.
http://asp.net/Tutorials/quickstart.aspx

To get into the ASP.NET swing of things, try your page like this:
<%@. Page Language="VB" %>
<script runat="server">
Sub Page_Load (s As Object, e As EventArgs)
lblDate.text = DateTime.Now.ToString("d")
End Sub
</script>
<html>
<head>
<title>Date</title>
</head>
<body>
<form runat="server">
The Current Date is <asp:Label id="lblDate" runat="server"/>
</form>
</body>
</html>

As Frank said, definitely work through the tutorials, and strongly consider picking up a copy ofASP.NET Unleashed, Second Edition. Make that, DEFINITELY pick up a copy of that book! Every new ASP.NET developer should have it.

Cheers Tmorton
I've bought ASP.NET unleashed, Second Edition. Excellent recommendation.
I've got the code to work now. I've stopped using dreamweaver for testing. I create my site and ASPX pages in dreamweaver then open the file in web matrix to insert my code and test the pages.
To follow on from your previous post.
Having used ASP.NET unleashed and looked at the tutorials on the site; I can't find samples of what I am trying to do. After covering adding the date and calendar sections as ways of adding real time data into pages, which technique would be best to add these to multiple pages with the view to making altering the modification properties easiest to change i.e. font type and color without having to change every page on the site?
Should I use Global.asax or the config file in the bin? Or is there another way.
Sorry for the long winded description but I am new to this so I need to explain what I am trying to do.
Any links or tutorial references will be great
Cheers
RDG01


RDG01 wrote:

I've bought ASP.NET unleashed, Second Edition. Excellent recommendation.



Yes, that book is highly recommended across the board. I am glad you are finding it helpful.


RDG01 wrote:


After covering addingthe date and calendar sections as ways of adding real time data intopages, which technique would be best to add these to multiple pageswith the view to making altering the modification properties easiest tochange i.e. font type and color without having to change every page onthe site?


This sounds like a job for a user control. Check out chapter 5 ofthe ASP.NET Unleashed book you have in your hands - Creating CustomControls with User Controls.


0 comments:

Post a Comment