I'm using Visual Studio 2012 Ultimate in Windows 8.
I'm confused as to how to start an asp.net web page web site. Is it via Visual Studio, by selecting File | New Website | ASP.NET Web Site (Razor v2) or (some other selection) or do I need to create the asp.net web page web site from WebMatrix and, if so, do I need to install WebMatrix separately from Visual Studio, or was it installed as a part of Visual Studio?
Searching for the existence of an app named "WebMatrix" in Windows 8 returned nothing...
UPDATE
Mike, I'm a third of the way through your book and I think it's great.
A couple of nights ago I read where you called braces brackets or vice versa and almost said out loud, "This cat must be a Brit!" I then read the frontispiece where that exact fact is declaimed.
Anyway, I was reading "C# 5.0 in a Nuts Hell" today at lunch, and read: (a llittle context: the Albahari boys are here discussing asp.net MVC) "What you lose over Web Forms is a designer. This makes Web Forms still a good choice for web pages with predominantly static content." (bottom of page 194).
This ("predominantly static content") describes the site I'm going to build to a T: most of the content will be static or simple links to other sites. The only non-static content will be pushpins on a Bing Map, but even these could be viewed as static (depending on one's definition of static), as they will really remain the same superset - the user just selects which subset they want to see at any given time.
The "static electricity" voltage of my site depends also on whether you call a PayPal button, a Twitter window, and rotating Ads to be static, too, I reckon.
Anyway, I said all that to say this: In my situation, would Web FORMS be better than Web PAGES? Pardon me if the rest of your book answers that question, but ... I'm not the most patient cat in the world.
WebMatrix is an IDE - not a development framework. The development framework that it was primarily designed to support is known as the ASP.NET Web Pages framework. However, within Visual Studio, it is known as an ASP.NET Web Site (Razor vx) and as you have discovered is accessible via the New Web Site option.
You do not need to install WebMatrix in order to develop these types of applications. However, WebMatrix offers more choice in terms of templates for Web Pages sites and starts up a lot quicker than VS. On the other hand, WebMatrix doesn't include any debugging tools.
WebMatrix is completely separate from Visual Studio and is not installed with it. If you want to install WebMatrix, you can get it here: http://www.microsoft.com/web/webmatrix/
This might not be the answer to the question, but I just started using WebMatrix and it seems much easier and convenient to use mostly because of the various templates available.
Related
I am working on a Web application project and although I am an experienced Visual Studio developer almost all of that has been in WinForms, console apps, Services, etc. That is, I have very little experience with using VS to develop web pages (Web Forms, asp.net, etc.), however, I am learning how to apply my previous Web page knowledge to VS.
One thing that has been throwing me for a while is how to apply additional CSS files in development, that should not be used in production (because they are already there). Specifically, I am working on a set of pages (DNN module) that is being deployed into a larger website context.
This all works fine, except the VS Web Page Design Editor is nigh useless because it's WYSIWYG rendering is not even remotely close to what the page looks like on the site. I know why this is happening: the site (and DNN) have their own set of CSS files that are getting applied/added to the page.
I know that I could just add those same style sheets to my web page in development (using <link href=...> tags?), however, then the web page would be deployed referencing these CSS files twice (there's a bunch of them too).
So my question is, is there any easy solution to this? Is there some setting somewhere that I can just say "use these additional CSS files in development or in the Design Editor"? (I hHve tried to google this, etc. but I just find dozens/hundreds of articles about how to add or edit CSS in Visual Studio)
Unfortunately I think that may have mis-explained my need somewhat. The issue really is not a development vs production issues, but rather an IDE vs execution issue. When debugging the code or otherwise running it in development, it is still within the DNN test environment we have setup, so it does have the extra file even here.
This is really about the HTML designer, when i am using it it does not have these extra style sheets, so I cannot see what the work I am doing really looks like. Instead, i have to run it every time I want to see whether any change i make looks like it is supposed to. This gets extremely onerous, especially with how slow DNN is to compile and reload.
Hmm, do you have your web project setup to run on IIS instead of IIS Express?
Something I do is often just work in the project then Save and if needed build. Then browse to the Site on my machines IIS instance (right click file in solution explorer and select browse if using ASP.NET Web forms).
Once I have done that I can refresh my page. I also use #if Debug in my code to bypass user login and etc to make round tripping faster...
I am developing a website in which I want to use ASP.NET MVC 5 because the site has the potential to be quite large and require the separation of concerns that MVC provides. However, the client wants me to show him a "prototype" of the home page which is simplay a single page that shows an image, some text, and requires a user login (and he wants to see it ASAP). How can I reconcile the fact that developing a proper ASP.NET MVC site requries a large amount of initial time to set up with my requirement to quickly put together a page to show my client what he has in mind? Should Also, should I consider using Web Forms over Razor for this initial part of the site?
You can prototype it fast just by modifying default view, without creating models controllers etc.
Login functionallity exists out of the box in MVC.
You can download one of MVC templates from Visual Studio.
Select File > New Project > Online > Templates.
You can find them also here (most of them are kept are up to date): https://visualstudiogallery.msdn.microsoft.com/site/search?query=mvc&f[1].Value=mvc&f[1].Type=SearchText&f[0].Value=templates&f[0].Type=RootCategory&ac=4
The Visual Studio Single Page Application template is super quick to setup. It'll run right out of the box. Just add your image and text to the Home view.
We have created our website on ASP.NET with C#. But another developer has created her code on VB.NET. Now we have to integrate her pages and code with our existing application.
You can't use VB and C# together within the same Web Application project. What I would recommend is that you convert the VB to C# (or vice-versa) using one of the many automated conversion tools that are available (Telerik has one, for example). Barring that, your next best bet would be to keep them as separate projects and deploy them together to the same site, if that's an option (for example, if each project will be able to have its own set of URLs). If that isn't an option, then you will simply have to bite the bullet and convert one language to the other.
For web application project:
asp.net web application with c# & vb.net both in codebehind
As mentioned by OP in comments, s/he is asking for Web Application projects; so the below is only for website projects:
You don't need to do anything. Just add those .aspx and .aspx.vb pages in your website project. If you are using .NET Framework 2.0 or above, they will compile and the complete website will work.
By the way, if you see, every .aspx page contains the Language attribute in #Page directive which specify the language of the code beside file.
I've created a website for a client of mine. It is coded in ASP.NET with C# and hosted on GoDaddy. She requires this website to updated daily by her. However, this client has very little knowledge of how to edit HTML or text within a site. I don't want to edit it every time she wants an update on the site.
What would be the best solution to my problem? I have looked up Content Management Systems, but I'm a little confused by what exactly it does in terms of coding and the management of the existing site. Does it require me to reformat the whole site to follow the CMS's 'templates'? Would it be better for me design my own back-end panel for her to edit the content (this would obviously take significant work)?
If you want to stick with a site you're developing from scratch, I'd use the HtmlEditor from the AjaxControlToolkit or a similar control, and store the html content in the database.
Then, when outputting the html from the database to the client pages, I'd make sure to use the Microsoft Anti-Cross Site Scripting Library to sanitize the html using the GetHtmlFragment() function (since this is tagged asp.net). It's not that much work, actually, if you design the database correctly, and if you've got the skills.
CMS systems are (trying not to oversimplify) entire web sites that are already built and allow people to edit the content using built-in content editing functionality. They range in functionality and extensibility from a "You get what you get and there's very little you can change" to "You can customize the heck out of it and buy or build your own modules to extend functionality." There are a lot of good ones out there, some free, and some expensive.
How do you understand "No control over your namespaces" namespace issue, quoted from,
http://reddnet.net/code/asp-net-web-site-vs-web-application-project-part-2/
Here are more background:
one of the cons of web site project type of VSTS 2005 is, my confusion is what exactly means "no control over your namespace"?
No control over your namespaces. Sure, you can manually add namespaces to pretty much anything, but visual studio will fight you every step of the way. With generated code such as ADO.NET DataSets and such, this gets very hard to control. Eventually you will give up and just let VS put everything in the default namespace. In large applications this gets very annoying, especially if you like a well structured application.
Appreciate if anyone could show a sample here.
Just test this: create a Web Application and a Web Site, then take a look to the namespaces created into the Default.aspx.cs:
WebSite: has no namespace
WebApplication: has namespace
When you have a very big application it's impossible to find your classes without namespaces.
Now create a DataSet:
WebSite: no .Designer.cs created -> namespace will be created automatically on the fly
WebApplication: .Desinger.cs created with proper namespace.
George, Web Sites are not specific to VSTS. That's a normal Visual Studio feature, haunting us since Visual Studio 2005.
Also, see https://stackoverflow.com/questions/237664/web-site-vs-asp-net-web-application-in-visual-studio.