This is a migrated thread and some comments may be shown as answers.

How to read css file from webresource.axd?

0 Answers 112 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alexander
Top achievements
Rank 1
Alexander asked on 13 Aug 2012, 11:56 AM
                            var executingAssembly = Assembly.GetExecutingAssembly();
//executingAssembly = {App_Web_serversummaryedit.ascx.e5f4f472.hriathhs, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null}
                            var webResourceDataArray = NavigationHelper.WebResourceData(webResourceCssPath).Split('|');
                            var webResourceName = webResourceDataArray[webResourceDataArray.Length - 1];
//webResourceName = Telerik.Web.UI.Skins.Grid.css
                            var resourceStream = executingAssembly.GetManifestResourceStream(webResourceName);
                            if (resourceStream != null)
                            {
                                var cssTextStreamReader = new StreamReader(resourceStream);
                                cssText.Append(cssTextStreamReader.ReadToEnd());
                            }

Why this does not work? How to read css from resource file by resource name?? :(

I suspect instead of Assembly.GetExecutingAssembly() must be something like loading Telerik.Web.UI.dll again? Btw, it resides in GAC.
So, how to manage all this?

UPDATE: Done!
var telerikAssembly = Assembly.GetAssembly(typeof(Telerik.Web.SkinRegistrar));

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Alexander
Top achievements
Rank 1
Share this question
or