Newbie question

522 views
Skip to first unread message

BigJ

unread,
Oct 5, 2008, 2:49:55 PM10/5/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
I'm using Visual Web developer express to create ASP.NET apps.

When I create a new file in the app_data directory, lets say
firstPage.aspx,

and then load the URL http://localhost:1302/firstapp/app_data/firstpage.aspx,
it gives throws this error:

Server Error in '/firstApp' Application.
HTTP Error 403 - Forbidden.
Version Information: ASP.NET Development Server 9.0.0.0

However when I make my own sub directory and put firstpage.aspx in,
http://localhost:1302/firstapp/subdir1/firstpage.aspx, it works fine.




Also another question, I have the file default.aspx with the following
code:
<%@ Page Language="C#" AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
void Page_Load(){
lblServerTime.Text=DateTime.Now.ToString();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>My First App</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Holla <asp:Label id="lblServerTime" runat="server"></asp:Label>
</div>
</form>
</body>
</html>


In this case, the asp Label does not output any code, which i'm
assuming is because lblServerTime is not set. However, if i change
the compiler directive at the top to <%@ Page Langauge="C#" %>, it
produces the correct output. What the difference in the attributes
that's causing this?

Thanks

Jon

Cerebrus

unread,
Oct 6, 2008, 1:07:26 PM10/6/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
1. You should look up the purpose of the App_Data folder. It is not
intended for code files / aspx pages.

2. Do you have any code in the Default.aspx.cs file which might
conflict with the code in the aspx itself ?

On Oct 5, 11:49 pm, BigJ <jonli...@gmail.com> wrote:
> I'm using Visual Web developer express to create ASP.NET apps.
>
> When I create a new file in the app_data directory, lets say
> firstPage.aspx,
>
> and then load the URLhttp://localhost:1302/firstapp/app_data/firstpage.aspx,
> it gives throws this error:
>
> Server Error in '/firstApp' Application.
> HTTP Error 403 - Forbidden.
> Version Information: ASP.NET Development Server 9.0.0.0
>
> However when I make my own sub directory and put firstpage.aspx in,http://localhost:1302/firstapp/subdir1/firstpage.aspx, it works fine.

Jon Liu

unread,
Oct 6, 2008, 1:45:44 PM10/6/08
to DotNetDe...@googlegroups.com
Cerebrus,

1) Thanks,  checked it out and looks like app_data is for file-based SQL files, not aspx.

2) I didn't modify my default.aspx.cs file at all, its the default one that is generated.  I took a look at it however and it looks like there was (i'm not sure if it's by default or not) a page_load function in there.  Either way, I simply took out the page_load from my default.aspx file and put it into default.aspx.cs and it worked.  Thanks!

Jon

Cerebrus

unread,
Oct 7, 2008, 12:18:34 PM10/7/08
to DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web Services,.NET Remoting
You're welome ! Glad you got it working. :-)
> > > Jon- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages