ASP.NET with VS 2010: Web Site or Web Application? - asp.net

When I start a new ASP.NET project in Visual Studio 2010, I can either create a new ASP.NET Web Site or an ASP.NET Web Application.
What's the difference between these two project types? Why would I choose one over the other?
Please note: this question is an exact duplicate of this one, but I'm asking specifically about Visual Studio 2010 (there are no answers targeted at VS 2010 in the original question). So are the answers of the other question still valid or are there any changes with VS2010 which results in different answers?

I just want to give an example that website means its a site by which we can get some information. they will be a collection of websites in a Web Application. Example take any company site. And coming to web Application the best example is Gmail. which is an application . which we use. This is the general difference between these two. Even it may also contain a collection of websites. But depending on the Requirement.

I know this question is a bit old, but just in case someone finds it..
I believe that if you want to use Web.config Transformations (useful if you want to have different setting's for development and release) then you need to be using a web application.
Technically this is probably a result of the same differences as in 2008 between a web site project or a web application project, but being that it's a new feature in vs 2010 (at least built in, i think you can get it in vs 2008 also) it's at least one new difference from vs 2008 to vs 2010 to consider when choosing which way to go.

I would recommend website only for a very simple/small application. Build times are higher, you cannot use nuget, there are no namespaces (although aspx and ascx class names can be pretty cool), no conditional compilation symbols, no immediate code tests (since there's no a single .dll to be referenced), etc.
In more complex scenarios the way to go is web application.

Related

How to access one web application from another in ASP.NET

I have solution with 3 projects. One is Website and another one is Services. I want to access page from Services project via AJAX from page on Website but i fail to do so since only one project it running.
How can it be done?
please avoid answers like "What have you tried ?" because this is general question with no relation to specific code.
I'm using IIS Express built-in with Visual Studio Express 2012.
Thanks
You can do this by specifying multiple start up projects.
Select the properties of the solution, go to Common Properties -> Startup Project.
Select Multiple Startup Projects and select the ones you need. You can also adjust the starting order.
Having said that, IIs Express serves up web applications even if Visual Studio is in debug mode or not, so this isn't strictly necessary.
Note: I don't have the Express SKU in front of me, so no guarantees that this is possible on that. If it isn't, then the answer is that it isn't possible.

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.

How should I approach a Sharepoint 2010 development project coming from WebForms and MVC?

I have a good amount of knowledge in the ASP.NET Webforms and MVC worlds. Shortly I will be tasked with implementing custom web applications with Sharepoint. I have great flexibility with this project (i.e - I can use custom web apps outside of Sharepoint if that's possible) but like most projects the most limiting factor I have to deal with is time.
Here are some questions that come to mind:
Can I easily integrate a custom MVC project into Sharepoint 2010? What are the pros and cons if I can?
Same as #1 only with Webforms.
If #1 and #2 are not viable solutions, can I easily create custom web applications within the Sharepoint world? What will the learning curve be with my background?
I understand developers can now use Windows 7 to deliver Sharepoint 2010 solutions. It looks like I can use a trial of Microsoft Sharepoint Foundations 2010. If that's correct, are there any development differences or gotchas I need to be aware of before digging into the Foundation version? I don't want to get up to speed on Foundation and then find out that the Server edition (the version that will be deployed) is vastly different.
Thanks!
SharePoint is based on webforms - it is relatively easy to add custom user controls and web parts, though if you want to use SharePoint data in a completely custom web app, especially mvc you will probably need to host it seperately - you can access everything you need through the SharePoint API, but it makes the deployment a lot more complicated.
The workarounds to get webforms mvc running in the SharePoint web app tend to involve stuff that would never get past corporate infrastructure people, but I've been getting good results with precompiled razor views set up based on http://razorengine.codeplex.com/ - my version that produces code which can be included in a SharePoint project is at https://github.com/tqc/RazorEngine
In the 2007 version there were significant architectural differences between WSS and MOSS. With 2010 there aren't as many differences, so you should be ok, but it would still be better to develop on the same version you are deploying to - download a trial of Standard or one of the demo VMs - If you do a lot of .net development, chances are you already have an appropriate dev license.
What are you trying to accomplish? Are you connecting your MVC site to SharePoint or are you building something "MVC" on top of the SharePoint server?
In any case, there is an MVC SharePoint project on Codeplex here http://sharepointmvc.codeplex.com/
Here is an article on the subject http://blogs.msdn.com/tom/archive/2009/03/17/asp-net-mvc-and-sharepoint.aspx
I havent touched it, and it seems a bit abandoned to me, but it might get you along.
Check out it outlines one method of running MVC with SharePoint
Generally, SharePoint will simplify many user-oriented requirements you may have - such as authentication, permissions control and personalised areas (with MySites).
If you go with SharePoint, you almost have to build your product for SharePoint Foundation so that you can keep your customers' total costs low (SharePoint CALs, SQL Server, hardware, etc). You'll want to build friendly user interfaces for managing permission, allowing your users to create their own pages, and other provisioning tasks -- or provide rock-solid documentation on how to do it out of the box with SharePoint. With SharePoint, you should use features and Web Parts to deploy your code either way , whether SaaS or on-premise. That will make it easier to deploy and upgrade.

Sharepoint WebPart

I'm new to developing in SharePoint and would like some tips please. I want to develop a WebPart. I understand that I effectively need to do this on a machine with SharePoint Server installed and create the web part as an ASP control. Once the control is created, how do I link it into SharePoint?
I would recommend you to take a look at the WSP Builder extensions for Visual Studio. It will simplify the development and deployment process for you, since it contains both templates for web parts, features and it will also package it up in a WSP solution for you.
I would read though this:
http://msdn.microsoft.com/en-us/library/ms452873.aspx
It will answer a lot of your questions about creating a web part, deploying etc.
If you're using the Microsoft Provided WebPart Visual Studio template...it will automatically be deployed to your site when you build it.
If you need to deploy to a test/production environment, you need to create a SharePoint Feature and then deploy the Feature to the server.
http://www.allaboutmoss.com/index.php/2010/03/22/hello-world-sharepoint-webpart-for-beginners/ helps you to create simple webpart and shows how it deploy in server.
You are able to build Web Parts in a number of different ways, through Visual Studio .NET using either the SharePoint Web Part Namespace or the normal ASP.NET Web Part Namespace further you are able to build Web Parts in SharePoint Designer using a combination of different technologies, such as XML Web Services.
XML Web Services will allow you to hook directly into SharePoint using SharePoint's Native Web Services, you can then create a Data View Web Part which will enable you to view, collate, filter and group List Items. This, of course, will also allow you to mingle normal HTML as well as XSLT syntax, allowing you to build logic into the Web Part.
The good thing about doing it this way is there is no "real' coding, i.e. no Code Behind page etc as there would normally be in ASP.NET. This also allows you keep things more or less SharePoint Centric, which is important because you may or may not have access to Central Admin or SSP nor indeed the Server itself, the 12 hive or the GAC.
How you decide to develop Web Parts should include thinking about all of the above, you may have a very restricted development environment. Further, you can also use Namespaces provided directly from GAC assemblies provided by Sharepoint, you may either need access to a development environment which has a MOSS or WSS Server on it or the PIA's or Assemblies from a MOSS/WSS Server.
I am a software developer, however, it is important for me to develop applications which are as SharePoint centric as they can be, which is why I decided to develop my Web Parts in SharePoint Designer. However, there have been times when using full VS.NET is the way to go, I would suggest you look at SharePoint Designer first, get a feel for the interface, XML Web Services, XSLT and HTML once you have created a SharePoint Designer Web Part and Provided this Web Part exists within a Web Part Zone, you can export the Web Part and reimport it into any number of Site Collections.
I must add that the above relates to SharePoint Lists and Libraries but it gives you a grounding to understand how it all fits together. it helped me understand more and made development of more coded Web Parts easier, It may not suit your individual requirements, SharePoint is a huge environment offering many paths.
Hope this Helps you out, search for SharePoint Designer... at least as a starting point.
Cheers

ASP.NET Web Site or Web Project [duplicate]

This question already has answers here:
ASP.NET Web Site or ASP.NET Web Application?
(25 answers)
Closed 3 years ago.
When creating a new ASP.NET project in Visual Studio should I chose create: website or project?
I understand that web application project was the way to do it back in the day with VS 2003 but is it still applicable today? What are some of the caveats using one over the other?
There's a pretty good comparison chart on MSDN.
Website projects are simple, in that all files added to the project folders are automatically compiled and included, which was supposedly added to make it more palatable to classic ASP and PHP developers. Once benefit is that it includes build providers, which allow for certain actions to be associated with a filetype - that's how the first release of SubSonic would rebuild the data access layer when you added a .abp file to the site.
Web Application Projects are a lot more flexible, though. For instance, all class libraries in a Website Project need to be in the App_Code folder, which is frustrating in a complex application. There are a lot of scenarios which just don't work for a Website Project.
You can convert from one to another, although if you're unsure I'd recommend just starting with a Web Application.
I strongly disagree with some of what the Websites and Web Projects article says.
First, it wasn't any "small" group of developers who rebelled - I'd suggest it was most of us, who had not been asked if we wanted to totally change the way we developed. They certainly didn't ask me if I wanted to lose six weeks of development time figuring out what they did to break a perfectly good web service.
It wasn't some "download" MS released - it was VS2005 SP1, and they released it pretty damned fast.
In their plusses for projectless development, the "Copy Project" command works very well, and we don't have to avoid debug or project files; you can move pages around - if you don't use source control; where do they get that you have to lock the project files in order to collaborate? What are they using for source control?
I'd also add one question to the debate: what's so special about web sites that they should be the only "project" type (as far as I know) that doesn't use a "project" file? I can't think of anything, unless it's that Microsoft thought that web developers were too simpleminded to understand projects.
Of course, if anyone knows of any other Visual Studio "project" type that does not use a project file, I'd be grateful to be informed of it.

Resources