Code-behind w/o VS.NET?

fizzled

Regular
Joined
Aug 9, 2004
Messages
52
Location
Atlanta, GA, USA
How do I write code-behind without Visual Studio.NET? I have the Microsoft .NET Framework 1.1 installed, as well as the Microsoft .NET Framework SDK v1.1. Finally I have Dreamweaver MX and Microsoft ASP.NET Web Matrix installed.

Pretty much every example I can find online assumes you are coding in a $1k piece of software however. Is there no decent alternative for a newbie to .NET?
 
You can try the asp.net webmatrix:

"ASP.NET Web Matrix is a community-supported, easy-to-use WYSIWYG application development tool for ASP.NET. It can be installed via a quick 1.3 MB download (about 5 minutes using a 56Kb modem). New features include: Access database support, J# support, design time enhancements including improved table editing and user-control rendering, many bug fixes, and much more! Best of all? It's absolutely free!"

Look at http://www.asp.net/webmatrix/default.aspx?tabIndex=4&tabId=46 for further info.
 
Well... you don't really NEED an IDE behind but it's good to have one because it's more easier to do the work like this.

But you could do the job with notepad also (some geek would use that). All you need is the <%@ Page language="WHICH_EVER_YOU_WANT" Codebehind="YOURFORM.aspx.cs" Inherits="NAMESPACE.YOURFORM" %>

And have the right namespace and class name for you .aspx.cs. Virtually... it could be named as you like.

Here it is... hope you'll take an IDE previously posted. You'll find it less difficult.
 
Thanks Arch4ngel. I've read that "in the Visual Studio .NET environment, a root namespace will be created with the same name as your project." (isbn: 0-7356-1935-2) So outside of VS.NET, how do I create my own root namespace? Does that go in the web.config or global.asax files?
 
the root namespace doesn't really mean all that much - in VB.net when you create a new project the namespace is set to the project name :confused: - all this means is if you create a class called Test - it's full name would be ProjectName.Test.
To create a namespace you would simply use the namespace keyword and put your classes inside it:
Visual Basic:
Namespace ProjectName

public class Test

end class

End Namespace
 
If I create a page: default.aspx. Does my codebehind class need to be named 'default'? And my namespaces in my codebehind files can have pretty much any name?

Code:
<%@ Page Language="C#" ContentType="text/html"
 Codebehind="default.aspx.cs" Inherits="SessionTest.default"
 ResponseEncoding="iso-8859-1" %>
<!-- default.aspx source -->

Code:
namespace SessionTest {
  public class default : Page {

    // class code here

  }
}

// default.aspx.cs source

Also, my codebehind files needs to be compiled somehow before I run it, doesn't it? How would I do this without VS.NET?
 
If your ASP.NET web page is called Default.aspx, and if you code in C#, then your code behind page would be named Default.aspx.cs.

Using code behind is the preferred way of doing things in the commercial arena, at least as I see it, since presentation and coding can be separated, keeping each independent of the other.

You can place your program code right in the ASP.NET page though if you want to and avoid using code behind. Not something per say I would suggest in the commercial arena since your code is right there so anyone who has a copy of your ASP.NET pages can see your code. Web surfers won't see it though since it is compiled before being served up by the web server. It does make things harder to maintain since both ASP.NET and C# coding are mixed together.

Depending on what you are attempting to do, you may find that something like C# Standard edition or VB.NET Standard edition will suit your needs of providing a Visual Studio interface to work within. I first began my research into .NET last year with a VB.NET Standard. This year I moved on up to Visual Studio .NET Professional. I purchased my copy from an on line seller and it cost quite a bit less than the $1,000 suggested retail price. If you shop around some you can find some pretty good deals.

Hope this helps. I would suggest just taking a bit of time, doing some research while considering what it is you are trying to accomplish. I know that an IDE such as VS.NET can be expensive, but given what it can do for you it might be the best choice to take. It will all depend on how much you plan to code, the purpose your coding will serve, and how much time you want to spend doing it.
 
You can also find an academic version of VS for about $100. The local college book store here sells it for that price.

Chester
 
Back
Top