What is the difference between ASP .NET Web Forms Applcation and ASP .NET Web Forms Site - asp.net

I need to write a simple app which will work in a cloud where I can store data about clients and it will be avaiable from Windows and Android and I assume it has to be a website.
What is the difference between ASP .NET Web Forms Applcation and ASP .NET Web Forms Site? Which one should I use?

Web Form Site is nothing more than previously called Website projects where you work with webpages which is just small php like (with Razor/aspx) script files which render as html.
Webform is more like a component oriented framework. Web Form Site or WebSite should only be used for small projects or if the project needs to be compile in C#/VB both language. Also if you want to put your all source code in web-server then it can be used. On contrary with WebForm application you don't need to put code base files to run the projects - you'd be better off only putting scripting .aspx files.

This has been explained in detail in the following question:
ASP.NET Web Site or ASP.NET Web Application?
Also, you can check out the differences between the two here:
MSDN

Regarding your first question if your app is native or hybrid then you need REST(WebApi in .net world) which any app can access natively regardless of the device and will meet your needs of the "cloud".
If you what you want is a website instead that is "viewable" by mobile devices you may want to make your website "responsive" and you can look at various bootstraps templates that can help you with that.
Regarding your second question I think it has no bearing nor it will make any difference in creating a mobile app which project type you use.

Related

Possible to create ASP.NET MVC web site (vs web application)

I'm looking at the differences between a Web Site and a Web Application on MSDN, and am drawn to the features of a Web Site because I am tasked with devising an architecture in which customers can heavily customize the application we deliver. It seems this feature of web sites would be useful:
You want to be able to update individual files in production by just
copying new versions to the production server, or by editing the files
directly on the production server.
However, I'm also drawn to the MVC architecture because it has built in features for minifying scripts that are delivered to the client. I also kind of like the idea of breaking up the architecture into clean pieces since this is a very large data model we have.
But from what I can tell, these sets of features appear to be mutually exclusive. Is that true? I can't readily figure out how to create an MVC application in which custom views could be dropped in as pure source files, and be able to run, nor can I figure out how to take advantage of any MVC framework when creating a "Web Site" project. Am I missing something or do I have to pick my poison?
Take a look at ASP.NET templates in VS2013. You can create an app with both MVC and WebForms. This will probably give you a good combination of what you need. By default, view files are not compiled, so you'll always be able to publish new files without doing a full push if you want. In fact, VS2012 even allows you to publish select files or folders.
The choice between web site and web app to be is very simple. If you are creating a mostly static app, choose "web site". If you are creating an app that has even a decent amount of dynamic capabilities, choose "web app". Web Sites are not really designed to be dynamic, so the more dynamic you do in that setting, the more of a headache it will be to properly maintain it as the architecture just isn't where it would need to be.
What I would suggest is to spin both of them up and try out some scenarios that you are interested and see what works and what doesn't. Really think about how users will actually want to customize the app. Will they want to copy and paste files to production or would they rather request features and have them built properly? Or maybe they want to work with a workflow instead?
So make realistic business requirements, prototype and then decide. But based on what I'm hearing you want a WebApp and probably one that does MVC and WebForms.
Now everything ONE ASP.Net. You will be creating a WebForm, MVC, Webpages using ASP.Net platform.
Check this video about new features in VS 2013
Not sure you can create website in ASP.Net 4.5.
From my experience, I would go with WebApplication based project, where managing namespace and other stuffs are easy. In website its hard to get the standard name for the classes(randome) generated.
Go with MVC web application.

Are ASP.NET mobile views only for ASP.NET MVC? or can they be used in plain ASP.NET as well?

I know in ASP.NET MVC you can have mobile views and do things like Index.mobile.cshtml and _Layout.mobile.cshtml and the server knows to serve these views/pages to mobile devices rather than Index.cshtml and _Layout.cshtml, but can this also be done in plain ASP.NET websites (not using MVC)?
Note : I am using razor syntax in the plain ASP.NET website.
Thanks in advance.
-- Lee
UPDATE :
To clarify, I am aware of the various browser detection methods. My question is specifically about whether mobile views in the form Index.mobile.cshtml are available in plain ASP.NET.
UPDATE (Functionality now included in ASP.NET latest release announced 18th February 2013) :
Talk of the devil.. this is now possible in a recent release..
Scroll down the page to the heading 'ASP.NET Web Forms Enhancements'
http://weblogs.asp.net/scottgu/archive/2013/02/18/announcing-release-of-asp-net-and-web-tools-2012-2-update.aspx
Take a look at this, brief description of mobile support for ASP.NET Web Forms:
How To: Add Mobile Pages to Your ASP.NET Web Forms / MVC Application
My understanding is that the alternate view modes support native to MVC4 is a result of the WebPages2 used by MVC, and is currently only used within MVC to resolve locating Views via the View Engine (combination of VirtualPathProvider and DisplayModeProvider). This is because views served up via MVC and requests via the URI do not map to physical locations on the server to serve up files from. ASP.NET on the other hand serves up files directly based off of the URI, and does not depend on a virtual path provider the way MVC does.
My guess would be that ASP.NET does not support automatically serving up alternate files based off of the same framework that MVC uses. That being said, I'm sure it would be possible to derive an implementation based off of the of the logic of VirtualPathProviderViewEngine that could achieve a similar result with ASP.NET, however I know of no implementation that does this currently. Best suggestion would be to see if you can find usages of DisplayModeProvider and see if anything pops up.
I'm not an expert so feel free keep looking but I thought I would offer what I can.
So I have come to the conclusion that this is not built in functionality in plain ASP.NET.
Though there are (IMO less elegant) alternatives.
Are ASP.NET mobile views only for ASP.NET MVC? Yes.
Update : This may be possible in latest release
http://weblogs.asp.net/scottgu/archive/2013/02/18/announcing-release-of-asp-net-and-web-tools-2012-2-update.aspx
-- Lee

I'm having trouble understanding exactly what ASP is and how to upload an ASP website

As of the start of this week I've been required to start learning how to develop websites in ASP. I have a moderate level of experience with C# through XNA, so that part of it isn't much trouble for me.
I've been following a Music Store Tutorial which takes me though setting up an "ASP.NET MVC 3" application.
I'm about done with the tutorial and have a functioning site when I run a test locally, but I don't understand what files need to be uploaded. I've worked on front-end updates for ASP websites before but they were completely different to this in terms of what files made up the site and so on.
I don't see a single .aspx page in my project which is what I assumed an ASP site was made of from experience. I'm starting to think that those projects weren't MVC projects but maybe just the "ASP.NET Web Application" style project.
Are ASP.NET and ASP.NET MVC different? From what I vaguely understand, MVC is just a framework that wraps ASP.NET? Also, is ASP something or is that just a synonym for ASP.NET? Finally back to my initial confusion, what files are to be uploaded onto the server when I want to launch an ASP.NET MVC project?
Do I just upload this entire directory and the server will handle it in the same way that the inbuilt testing ASP server does? Or is the site compiled down into a couple of files somehow and I just upload one of these directories (I think I read that somewhere).
ASP is an acronym for Active Server Pages. Pre .NET, ASP was Microsoft's first iteration scripted web pages. All of those pages typically ended with the extension .ASP.
When .NET was released, ASP was overhauled significantly and renamed ASP.NET. The new version of ASP.NET attempted to model web development similar to windows application development, where you used controls and an event handling model. That was Microsoft's primary model for web page development for many years, and it still around and supported, but today it is referred to as ASP.NET Web Forms. ASP.NET Web Forms pages typically have the .ASPX extension you mentioned.
In the mid-2000s or so, Ruby on Rails took off, using an MVC based model for developing web applications. A few years later, Microsoft released an alternate version of ASP.NET, called ASP.NET MVC, which used similar concepts. Many people feel the MVC approach is a more natural method for developing web pages than the web forms model (note epic Q/A threads on this very site a few years ago). In any case, ASP.NET MVC shares parts with ASP.NET Web Forms, but looks and works pretty differently; for one thing, there are no .ASPX pages as MVC, for the most part, uses a different form of routing to determine what to display.
That's a very brief history that glosses over a whole lot of subjects. What you've posted a screenshot of, is an ASP.NET MVC project.
As far as publishing is concerned, the typical route for publishing an ASP.NET website is to open the project in Visual Studio, select Build|Publish, and tell VS where to put it. Depending on what method you use, you may have to do additional configuration in IIS on the box where you published the site.
First off, when you say ASP, you're referring to old (obsolete) tech. ASP.NET is specifically what you're referring to in your question.
ASP.NET is a Microsoft technology which works cooperatively with the IIS server to provide a "Windows Application" type experience with web sites. Your web site logic is compiled in to a .NET DLL "Class Library." When a web request hits IIS with a URL matching your application directory, IIS starts up your application internally and maintains it.
I don't understand what files need to be uploaded
Visual Studio actually has a built in publisher available for your use. See the Build -> Publish menu in VS / Web Developer.
I don't see a single .aspx page in my project which is what I assumed an ASP site was made of from experience.
ASP.NET Web Forms uses the aspx extension for Pages, their frontend rendering component. On the other hand, ASP.NET MVC uses the concept of Views, which are not relient on a specific component. See the next paragraph.
Are ASP.NET and ASP.NET MVC different?
Yes. No. Maybe. ASP.NET contains all the "magic" which allows IIS - the web server - run the web application and serve up web pages. Volumes could (and have) been written on this. ASP.NET also supports much configuration through the means of Http Modules and Providers. These components are declared and configured through the web apps web.config file and are typically automagically created and persisted by IIS and ASP.NET. They collectively make up the glue that makes ASP.NET just work out of the box.
MVC was built on top of the existing foundation classes of ASP.NET. Some features have been loaned, a few have been replaced and more than a handful have been created in order to support the model-view-controller pattern.
For example, MVC gives us support for View Engines - a runtime library which allows us to write our Views (web pages) in a particular format. The ASPX View Engine existed during MVC's launch. Later came Razor, employing the .cshtml extension. Users of the MVC Framework have implemented a wide variety of their own view engines as well. This is possible due to the modular nature of ASP.NET and MVC.
Do I just upload this entire directory and the server will handle it in the same way that the inbuilt testing ASP server does? Or is the site compiled down into a couple of files somehow and I just upload one of these directories (I think I read that somewhere).
I would recommend using the Build -> Publish menu in Visual Studio. You may use web deploy if your host supports it, but FTP and File System methods are available as well.
The bin folder contains the class libraries required to run your web application on the server. The web.config file provides the configuration to do so. However your Views are not compiled in to the assembly. They are published as-is and are rendered lazily by the view engine.
You are probably familiar with ASP.NET WebForms, this is an MVC project. You can find more here:
ASP.NET MVC
In order to upload the site, you need to publish the website from inside Visual Studio to a local file location and then upload everything to the website.
If the target server doesn't have MVC installed, you can right click on the website project in Visual Studio and select "Add Deployable Dependencies".
This will ensure that the server has all the required files to run an MVC project.

Visual Studio 2010: convert website project to web application project?

I have an existing solution in VS2010. When I click the properties of my project I get the view as can be seen in image1.png:
When I create a new empty ASP.NET web application and click the properties of my project I get the view as can be seen in image2.png:
A huge difference.
Now I'm implementing this code here: http://wcf.codeplex.com/wikipage?title=Getting%20started:%20Building%20a%20simple%20web%20api
And that tutorial assumes I get a view as I've shown you in image2.png
In image1 and image2 I've also marked the menu items: "Website" and "Project"
This makes me assume that I've created a website application whereas I need something different (I'm thinking a web application project).
Not sure what to do now, I need to convert my current application to another thing, but to which type and how to do it?
I also came accoss this post: http://blogs.msdn.com/b/webdevtools/archive/2009/10/29/converting-a-web-site-project-to-a-web-application-project.aspx
But before I start screwing up everything :P Is that what would solve my problem?
It should be possible to use either a web site or a web application project. In the example on the link you've posted, they use the predefined template for ASP.Net MVC Web Applications. This has several advantages - it sets up the structure and other resources for you - it's effectively a template.
For the purposes of the tutorial, why don't you just set up an application that way? If you've already written some code, you can just import it into the new application.
For future projects, you might want to consider which is best for your needs. Apart from structure, there are some other key differences between a web application and a web site project.
MSDN handily provides the differences here:
http://msdn.microsoft.com/en-us/library/dd547590.aspx
If you find you want the features of the web application, then the link you've posted is fine. You'll need to do some re-organizing of your references and so on and so forth, but the process is fairly straightforward (but not painless).
A "web site" in visual studio is the old, .net 1 style of creating web sites. It basically dynamically compiles the code in a folder when it's hit for the first time. Later .NET introduced a "web application" model where the code is compiled into a DLL and no code files are deployed with the site. "Web sites" are pretty much depcrated and shouldn't be used for any new projects unless you're doing a quick demo site.
The codeplex project you referenced also depends on MVC 3 (which are web applications).
You are probably better off just restarting like the tutorial says - create a new MVC application like it shows in its first screenshot.
If you do not have that option, use Web Platform Installer to add MVC for you - http://www.microsoft.com/web/downloads/platform.aspx
Good luck!
I can't tell exactly what's going on from your screenshots, but if you have a web site that you need to convert to a web application project, you can find the directions here
Although the instructions are specific to VS2005, they are basically the same for 2010 as well.

What is the difference between a simple ASP.Net website and ASP.Net webapplication?

In Visual Studio, I tried a project in both. But there appears to be no difference in the tools displayed in the tool box....
So what the real basic major difference.?
See these:
ASP.NET Web Site or ASP.NET Web Application?
Website is for internet based audience - in this case your concerns(security, etc) are different;
Web application is a software, just like a desktop application software, usually intended to be used for intranet environments. For instance, an HR software could be a web app - that is available on the intranet for all the departments to fill in their timesheets.
Though, a website may contain specific operations, tasks, or workflows.
Checkout: Web site project vs Web app project
WebSite project is compiled on the fly.
In a WebApplication, you need to build a page before you can debug.
However, WebApplication is the way to go, because with WebSite-project, you cannot create a setup project (and conversion from WebSite to WebApplication can lead to problems/bugs).
That's why I recommend WebApplication.
Simply put, a WebSite is worth nothing if the customer is too stupid to install it manually.

Resources