This tutorial demonstrates CORS support in ASP.NET Web API. We’ll start by creating two ASP.NET projects – one called “WebService”, which hosts a Web API controller, and the other called “WebClient”, which calls WebService. Because the two applications are hosted at different domains, an AJAX request from WebClient to WebService is a cross-origin request.
What is “Same Origin”?
Two URLs have the same origin if they have identical schemes, hosts, and ports. (RFC 6454)
These two URLs have the same origin:
These URLs have different origins than the previous two:
Internet Explorer does not consider the port when comparing origins.
for more: http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api
Also from Microsoft Web-API: http://www.asp.net/web-api/overview
ASP.NET Web API is a framework that makes it easy to build HTTP services that reach a broad range of clients, including browsers and mobile devices. ASP.NET Web API is an ideal platform for building RESTful applications on the .NET Framework.
The new bundling/minification feature now allows you to instead bundle and minify all of the .css files in the Styles folder – simply by sending a URL request to the folder (in this case “styles”) with an appended “/css” path after it.
This will cause ASP.NET to scan the directory, bundle and minify the .css files within it, and send back a single HTTP response with all of the CSS content to the browser.
A 90 seconds Video.
Those of you who have been building ASP.NET applications for a while now are no doubt familiar with the provider model, which includes provider abstractions for membership (authentication), roles (authorization), profiles (user data), and session state. These providers make it incredibly easy to provide a secure framework for your application. In fact, with an ASP.NET application template right out of the box, you can have a fully functioning authenticated, secure website in minutes.
What a lot of people have less familiarity with is the notion of provider services. You can actually create a WCF service head that sits on top of the ASP.NET membership system. This allows client applications (WP7) to authenticate against your ASP.NET website using exactly the same authentication scheme that your users use. This means that a user who has access to your website should also be able to have access to the client application seamlessly.
If you already have an ASP.NET application that is using the membership provider, role provider, and profile provider you can quickly, easily, and securely expose services to a mobile (WP7) client that allow that client to have secured, remote access to services exposed by that site. In short, any user of your existing web application can use their existing credentials to log in from their WP7 device and access any services you decide to make available.
ASP.NET provider services, coupled with WP7 and the fact that Silverlight has access to WCF client proxy generation, means you can very easily prep your site for a rich WP7 experience.
To read more…
Page.MetaKeywords and Page.MetaDescription properties
One simple recommendation to improve the search relevancy of pages is to make sure you always output relevant “keywords” and “description” <meta> tags within the <head> section of your HTML. For example:
One of the nice improvements with ASP.NET 4 Web Forms is the addition of two new properties to the Page class: MetaKeywords and MetaDescription that make programmatically setting these values within your code-behind classes much easier and cleaner.
It is pretty common within web applications to move pages and other content around over time, which can lead to an accumulation of stale links in search engines.
In ASP.NET, developers have often handled requests to old URLs by using the Response.Redirect() method to programmatically forward a request to the new URL. However, what many developers don’t realize is that the Response.Redirect() method issues an HTTP 302 Found (temporary redirect) response, which results in an extra HTTP round trip when users attempt to access the old URLs. Search engines typically will not follow across multiple redirection hops – which means using a temporary redirect can negatively impact your page ranking. You can use the SEO Toolkit to identify places within a site where you might have this issue.
ASP.NET 4 introduces a new Response.RedirectPermanent(string url) helper method that can be used to perform a redirect using an HTTP 301 (moved permanently) response. This will cause search engines and other user agents that recognize permanent redirects to store and use the new URL that is associated with the content. This will enable your content to be indexed and your search engine page ranking to improve. ASP.NET 4 also introduces new Response.RedirectToRoute(string routeName) and Response.RedirectToRoutePermanent(string routeName) helper methods that can be used to redirect users using either a temporary or permanent redirect using the URL routing engine.
For more goto –> ASP.NET 4 SEO Improvements (VS 2010 and .NET 4.0 Series) – ScottGu’s Blog
One of the frustrating aspects of working with CSS (one of many, actually) is the amount of duplication in a .css file. .less help to keep your CSS files DRY using 4 constructs:
- Nested Rules
An HTTP handler is configured to respond to requests for the .less files.
<add type="dotless.Core.LessCssHttpHandler, dotless.Core" validate="false" path="*.LESS" verb="*"/>
When a request arrives for a .less file it is the handler’s job to parse the .less file and transform it into standard CSS rule sets.
#1 | ASP.NET 4 "Quick Hit" – Chart Control 2 minutes, 42 seconds
#2 | ASP.NET 4 "Quick Hit" – Dynamic Metadata 5 minutes, 37 seconds
#3 | ASP.NET 4 "Quick Hit" – Permanent Redirect 5 minutes, 35 seconds
#4 | ASP.NET 4 "Quick Hit" – Imperative WebForms Routing 12 minutes, 39 seconds
#5 | ASP.NET 4 "Quick Hit" – Declarative WebForms Routing 14 minutes, 16 seconds
#6 | ASP.NET 4 "Quick Hit" – Outbound WebForms Routing 6 minutes, 18 seconds
#7 | ASP.NET 4 "Quick Hit" – Auto Start 11 minutes, 38 seconds
#8 | ASP.NET 4 "Quick Hit" – Clean Web.Config Files 2 minutes, 41 seconds
#9 | ASP.NET 4 "Quick Hit" – Predictable Client IDs 10 minutes, 47 seconds
#10 | ASP.NET 4 "Quick Hit" – Selective View State 6 minutes, 40 seconds
#11 | ASP.NET 4 "Quick Hit" – The HtmlEncoder Utility Method 5 minutes, 8 seconds
Via ASPNET 4 : The Official Microsoft ASP.NET Site