-1

EDIT: Please note that the answers pointed out are more than 7 years old. So, as stated in the question, I wanted to know in case there are any changes in 2018.

Secondly, I also was wondering about the process of the hosting of the site on the web server which was never mentioned in the question. This has been answered by @mlhDev.

ORIGINAL: I tried searching a lot but all the references to ASP.NET folder structure, either refer to very old versions of .NET or are based on ASP.NET MVC / ASP.NET Core.

I am very new to ASP.NET (coming from a background of Classic ASP and trying to upgrade). Please guide me in case there is a recommended directory structure for ASP.NET Web Applications (No MVC or Entity Framework or any other fancy concepts for now).

I also tried looking for IIS on my Windows 10 machine, it was needed to be installed through "Add Windows Features" but I am confused:

  1. How could I browse my web app without installing IIS
  2. After installing IIS, I still can't see my application files, so where are these files deployed?
  3. And, where are App_Code, App_Data, and other such folders, do I need to create these explicitly or are these added automatically.

Any help shall be appreciated.

Yelena
  • 423
  • 3
  • 14
  • See this question. https://stackoverflow.com/questions/7480437/asp-net-app-data-app-code-folders. If you've installed Visual Studio (the community edition is free) then a version of IIS comes with that and launches when you start debugging. ASP.net uses compiled code, so generally you don't upload your .cs files to the server, just the assemblie (ie the compiled .dll) – John Oct 29 '18 at 11:05

1 Answers1

0

Visual Studio utilizes a non-admin mode program called IIS Express (successor to Cassini, a similar idea but a different product) that does not require elevated or UAC permissions to host a website, it has become the default for new Visual Studio web projects. This is why the IIS you are familiar with is not required to be installed.

ASP.NET Web Forms (the not-MVC flavor) takes after other C# projects and allows you to compile your C# code, allowing for separate files for the UI (.aspx files) and the logic (.aspx.cs, called the code-behind) and producing compiled output: these code-behind files are compiled into a dll file and are deployed in a /bin folder on the production web server. There is also a way to compile the UI files.

Yes, there are some magic folders that accomplish differing degrees of magic, but no, you don't have to create them until you need them. If a tutorial says 'place this in your app_code folder' and you don't have one, create it at that time.

I referenced C# for those examples but ASP.NET fully supports VB.NET as well as any other CLR language (though the community and tooling support will vary).

Personal advice from ASP background

I came from the ASP classic world so I think I know where you are coming from. I'd like to make a few more points you didn't ask about.

There are two types of ASP.NET Web Forms projects, the most common being a Web Project. It requires that you have a project file (.csproj) that keeps track of the pages included in your project. This goes with the compile-time support - Visual Studio needs to know what to compile and what to ignore, embed, etc.

The second type is much more nuanced, called a Web Site. I would not recommend using it as a learning opportunity as it is very finicky and as your project scales you encounter a lot more random issues requiring lots of digging. I mention it as an ASP Classic-to-ASP.NET upgrade path for your code. It is the most like classic. You do not have a project file, you simply point to the folder where you code resides. What you see (in Windows Explorer) is what you get. But very finicky - low learning curve from classic but higher maintenance curve than a Web Project.

Finally, even though I said the UI file and the code file are separate, you can have your code in the same file as the UI. Again, not recommended for learning as this leads to super sloppy code that's difficult to maintain, but if you are trying to upgrade a super large classic code-base with the least amount of rework, this may be of interest. ASP.NET goes through a "page life cycle" which I'm sure you'll read about but if all your code is executed in the pre-render or render stage, you end up with an execution model and structure very similar to ASP Classic.

I would not recommend those three things (Web Site code base, no code-behind file, and only utilizing the pre-render stage) especially if all you are trying to do is learn the technology and professional advancement; I only mention to save you time if you are upgrading a large ASP Classic code base.

mlhDev
  • 2,235
  • 1
  • 22
  • 43
  • Thank you very much for the information. I am trying to upgrade a large classic codebase and I sure your guidance would be a great help. Many Thanks. – Yelena Oct 29 '18 at 23:39