ASP.NET Theme on CDN - asp.net

We want to distribute our .NET Themes out to edge of the Cloud.
However, my research through Google and Help files tells me that ASP.NET Themes (App_Themes) must be served from a physical sub-folder of the web server folder or an IIS virtual directory; ergo: Themes cannot be served from a CDN (we are currently using AWS). This seems a major failing and I hope that I am just going to get flamed for not researching properly, but I have to ask:
Does someone know of a way of serving ASP.NET Themes from a different server (and URI) than the web application that uses the Themes?
(Windows Azure could be a possibility, if it is a/the_only way to achieve this.)

Using themes and skins you primarily style server controls. Then it doesn't make sense to have theme files in CDN, since they are processed by the server.
Themes vs. Cascading Style Sheets
Themes are similar to cascading style sheets in that both themes and style sheets define a set of common attributes that can be applied
to any page. However, themes differ from style sheets in the following
ways:
Themes can define many properties of a control or page, not just style properties. For example, using themes, you can specify the
graphics for a TreeView control, the template layout of a GridView
control, and so on.
Themes can include graphics.
Themes do not cascade the way style sheets do. By default, any property values defined in a theme referenced by a page's Theme
property override the property values declaratively set on a control,
unless you explicitly apply the theme using the StyleSheetTheme
property. For more information, see the Theme Settings Precedence
section above.
Only one theme can be applied to each page. You cannot apply multiple themes to a page, unlike style sheets where multiple style
sheets can be applied.
Source: ASP.NET Themes and Skins

Related

Fixing Style Layout for MediaWiki SpecialPages

The skin I've installed (foreground) runs fine on all my pages including special pages except the login account page.
I've tried going to my skins/foreground/assets/stylesheets folder and do some editing on their CSS scripts, but they just implement minor changes.
I want to see if there's a way I can rebuild/modify the CSS or general template of just the login page, with the foreground skin I've already installed.
Many wikis use pages like MediaWiki:Common.css to create a custom 'theme' for their wiki. However, due to security reasons, site-wide CSS on restricted special pages was disabled starting with MediaWiki versions 1.19.20.
By default such style sheets no longer load on login or preference pages creating an inconsistent user interface. In order to fix the UI you need to set the variable: $wgAllowSiteCSSOnRestrictedPages to true in LocalSettings.php.
This will enable the skin for the special pages mentioned.

Which is better in asp.net 2.0?

Can anyone tell me themes are better or CSS style sheets are better in asp.net for design?
Please explain the concept also with an example.
A theme can specify both .skin files and .css files. So there no reason not to use themes.
As for skins versus css: Go for css if its css'able.
You should combine them. Use your css files in the theme folder for your normal styling of all the html elements in your website (include all the generated elements).
In the skin file of a control, you can set the default css class. Other properties like the layout and default behaviour of the elements (sample: calender control) are editable here too.
Skin files are good for all layout specific configuration you can't easily do with css, but with the .net properties of the controls.
Basically themes is built for server controls. You can not use themes with html controls.
The css is used for server controls,html controls and tags. If you are using only server controls then you can use "theme" because you can enable or disable theme on control basis, page basis and whole website basis.
In my opinion CSS is best way to design website. because after rendering theme it shows the css style with controls and tags.
You can also use "Theme" and "CSS" together.
Same query is avilable at my post at following link.
ASP.NET 2.0, AppTheme: How can we utilize AppTheme in best way for my ASP.NET WEBSITE
It make you happy

ASP.NET 2.0, AppTheme: How can we utilize AppTheme in best way for my ASP.NET WEBSITE

I am writing asp.net website which will going to be host on public network. I don't have very much knowledge about AppTheme specially utilizing theme, css and skin in asp.net 2.0.
Previously i have worked with asp and asp.net 1.0 where i only write css class and write attribute class="***" inside every control where i want to have css.
I don;'t know whether this is right practice with asp.net 2.0 because in asp.net 2.0 we have advance features like theme and skins.
So can i have help from you so that i can use theme, css and skin in best way . Also i would like to know how different is using css with asp.net 2.0 AS COMPARE WITH PREVIOUS VERSION.
Themes are made up of a set of elements: skins, cascading style sheets (CSS), images, and other resources. At a minimum, a theme will contain skins. Themes are defined in special directories in your Web site or on your Web server.
Here are some links from MSDN that will help you get started:
ASP.NET Themes and Skins Overview
How to: Define ASP.NET Page Themes
How to: Apply ASP.NET Themes
How to: Apply ASP.NET Themes Programmatically
Walkthrough: Creating User-Selectable Themes
Also, I would recommend Scott Allens article on Themes In ASP.NET 2.0 for a quick overview and some samples:
http://www.odetocode.com/articles/423.aspx
Your work shouldn't change that much (if you're working with a single theme).
Your CSS classes will stay as they are at the moment - they'll be used on the client side
You'll add skin files to your theme - these are used for server control style settings
The main difference is that you're able to define several different themes at the same time. Otherwise it depends on you how simple your HTML is. The best way is to not include any style information inside your ASPX files. You should use only use classes. Everything else should be styled within your CSS files.
Oh and BTW: all your CSS files within your App_Themes/Theme folder will be automagically added to your pages. You don't have to explicitly add them to your Master/Aspx page.

Questions on ASP.NET themes?

1) If I create a theme and a skin file and a css file to go with that theme, does the skinfile automatically pickup the css file I created? What happens if you have multiple css files under a theme?
2) Do css files in themes override global css files? I created a global one and the theme that had a css file did not change the background color to the one I had in the theme, but the theme that did not have a css file, did change the background color to the one in the global css file.
3) It appears that skins and css files are the same? Can't I just create a theme and use css files within the themes instead of skins? Are skins just for asp.net server controls?
I dont like skinning and prefer to just use plain ol CSS. Thats precisely what a skin is but very limited. I say drop the skin and stick to CSS files.
You can have many theme folders within the App_Themes folder. An ASP.Net Theme can consist of many skin files and many css files.
Yes, the Skin file is aware of the CSS file. When you apply a Theme, your page is made aware of all of the .css files in the Theme automatically.
I'm not sure. Testing is the only way to go.
No, .skin files are different than .css files. Yes, you can just use css files in a theme and skip the skins. Yes, skins are just for asp.net server controls.
Themes vs. Cascading Style Sheets
Themes are similar to cascading style sheets in that both themes and style sheets define a set of common attributes that can be applied to any page. However, themes differ from style sheets in the following ways:
Themes can define many properties of a control or page, not just style properties. For example, using themes, you can specify the graphics for a TreeView control, the template layout of a GridView control, and so on.
Themes can include graphics.
Themes do not cascade the way style sheets do. By default, any property values defined in a theme referenced by a page's Theme property override the property values declaratively set on a control, unless you explicitly apply the theme using the StyleSheetTheme property. For more information, see the Theme Settings Precedence section above.
Only one theme can be applied to each page. You cannot apply multiple themes to a page, unlike style sheets where multiple style sheets can be applied.
Quoted from: ASP.NET Themes and Skins Overview
My Opinion:
Generally, if you've got a good understanding of CSS you don't really need .Skin files but Themes are still useful.
The Themes in asp.net are a bit confusing, they are somewhat css and a somewhat finicky.
Stick to normal css and create your own skin framework (eg: configured css folder)
It will be much easier to use things like jQuery plugins with normal css and it will easier to work with designers who know normal css for cross browser development.

master skin file in ASP.NET

My project has multiple themes with different colors.
I need to skin certain textboxes with a specific font/size/etc.[no color difference]
Currently, I add <asp:TextBox SkinID="skinned" runat="server".../> to all .skin files under each theme.
Is there a way to put this textbox skin in one place, like a master skin?
The lack of inheritance or cascading in the ASP.NET Themes implementation is an unfortunate limitation that doesn't receive a lot of attention. In scenarios where you wish to have a global skin available to all themes (without changing the control definition itself), you have two options:
Option #1: Use a VirtualPathProvider
(The downside of this is that you can't use it on precompiled websites without a reflection-based workaround.)
You can define a Global.skin file under a special Global theme where shared skins are kept; you will also create a placeholder Global.skin file under all other themes as well:
App_Themes
- Global
\Global.skin (primary)
- ThemeA
\Global.skin (empty placeholder)
- ThemeB
\Global.skin (empty placeholder)
In the VirtualPathProvider you would then re-route all requests for App_Themes\*\Global.skin to App_Themes\Global\Global.skin.
Option #2: Use a Post-Build Task
This is an amendment to the above solution that avoids the precompiled websites limitation; instead of doing the re-route at runtime, you can apply it post-build via an ms-build task that simply propagates Global\Global.skin to all other theme folders.
I've used both options successfully.
You will need to list it under each theme, but you only need to list one control definition per theme. If you want a skin to be the default behavior for a control, specify the definition without a SkinID property.

Resources