Monday, March 26, 2012

Simple beginner questions

I created a C# ASP.Net project in Visual Studio 2003 called CS1.
When I navigate to http://localhost/CS1/webform1.aspx, my new ASP.Net web pa
ge displays fine.
But I want to rename the page to default.aspx and make it the home page for http:/
/localhost.
When I rename the page from "webform1" to "default", not all of the code in
the changes. For example, the name changes from "webform1.aspx.cs" to "def
ault.aspx.cs" but the public class remains "public class webform1." "Defaul
t" is a keyword so I cannot change the name of the class mannually. So I ju
st leave it as is. What kind of problems can this cause if my naming is not
consistent within a page?
Also, how do I "publish" my changes from the CS1 project to the home directo
ry? Or maybe a better question is: How do I create a "default" or "root" p
roject in Visual Studio .Net?
Thanks
Daveinline
"Dave" wrote:

> I created a C# ASP.Net project in Visual Studio 2003 called CS1.
> When I navigate to http://localhost/CS1/webform1.aspx, my new ASP.Net web
page displays fine.
> But I want to rename the page to default.aspx and make it the home page for http
://localhost.
> When I rename the page from "webform1" to "default", not all of the code in the ch
anges. For example, the name changes from "webform1.aspx.cs" to "default.aspx.cs"
but the public class remains "public class webform1." "Default" is a keyword so I c
ann
ot change the name of the class mannually. So I just leave it as is. What
kind of problems can this cause if my naming is not consistent within a page
?
This will only cause problems when trying to figure out in which file a
class resides. Also, naming is better off if you don't use webform1 as a
class name. Try to be descriptive. If you create a default.aspx page you
will see the class name is _Default. I think _Default is fine for a class
name. The reason here is because if you are using C# and VS.NET then the
full name of the class will be Solution.Project.Folder._Default which I
personally feel is fairly descriptive.

> Also, how do I "publish" my changes from the CS1 project to the home directory?
Or maybe a better question is: How do I create a "default" or "root" project in Visu
al Studio .Net?
The default directory should be created for you. You may need to go into
IIS (start -> ctrl panel -> administrative tools -> 'IIS' OR 'Internet
Services Manager') right-click the web site directory, go to properties then
'create' the application.
To update a server all you need to do is copy the .dll file into the bin
folder under the root folder. Then update any .aspx or .ascx files you
changed.
HTH,
Ryan

0 comments:

Post a Comment