+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / How to Remove Telerik.Web.UI.WebResource.axd js

How to Remove Telerik.Web.UI.WebResource.axd js

8 posts, 0 answered
  1. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    31 Jul 2014
    Link to this post

    Hi guys,

    I'm using sitefinity 6.3, Windows 8 machine. In my web sites it will auto add Telerik.Web.UI.WebResource.axd Javascript file. How can I remove it  ? 

    Regards

    Minco 


  2. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    31 Jul 2014
    Link to this post

     My web sites will auto add  two files.   In my page template  I have  assigned my custom Theme

    Please see the information below.

    <link href="/Telerik.Web.UI.WebResource.axd?compress=0&_TSM_CombinedScripts_=%3b%3bTelerik.Sitefinity.Resources%2c+Version%3d6.3.5000.0%2c+Culture%3dneutral%2c+PublicKeyToken%3dnull%3aen%3afc2ebef4-f9ad-4295-94c5-72ca5c30cdcc%3a4a0e9096%3a68ef0189" type="text/css"rel="stylesheet" />
     
     
    <script src="/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl03_TSM&compress=0&_TSM_CombinedScripts_=%3b%3bTelerik.Sitefinity.Resources%2c+Version%3d6.3.5000.0%2c+Culture%3dneutral%2c+PublicKeyToken%3dnull%3aen%3afc2ebef4-f9ad-4295-94c5-72ca5c30cdcc%3a9324ecca%3a472a0b31%3a261b43f4%3acaa640fd%3bTelerik.Sitefinity%2c+Version%3d6.3.5000.0%2c+Culture%3dneutral%2c+PublicKeyToken%3db28c218413bdf563%3aen%3aa2fff8da-9d1a-4072-a015-7a0a90a434ae%3a89799d3c" type="text/javascript"></script>

  3. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    01 Aug 2014
    Link to this post

    help ,help ....

  4. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    01 Aug 2014
    Link to this post

    A moment ago , I found this remove Telerik.Web.UI.WebResource.axd .   I have assigned theme  for page template, but it doesn't ok,  the styles also hard-coded into this file telerik.web.ui.webresource.axd  and auto linked telerik.web.ui.webresource.axd 
     js  file.

    Who can tell me how to remove it ?  

  5. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    01 Aug 2014 in reply to minco
    Link to this post

    Hi Minco,

    You can override Render event in your master page and remove any unwanted nodes.

    protected override void Render(HtmlTextWriter writer)
            {
                var tw = new StringWriter();
                var htw = new HtmlTextWriter(tw);
                base.Render(htw);
                var pageSource = tw.ToString();

                pageSource = RemoveScripts(pageSource);

                writer.Write(pageSource);
            }

     

    private string RemoveScripts(string html)
            {
                var htmlDoc = new HtmlDocument();
                htmlDoc.LoadHtml(html);

                if (htmlDoc.DocumentNode == null)
                    return string.Empty;

                var scriptNodes = htmlDoc.DocumentNode.SelectNodes("//script")
                    .Where(i =>
                        i.GetAttributeValue("src", string.Empty).Contains("WebResource.axd") ||
                        string.IsNullOrEmpty(i.GetAttributeValue("src", string.Empty))
                        );
                var linkNodes = htmlDoc.DocumentNode.SelectNodes("//link")
                    .Where(i =>
                        i.GetAttributeValue("href", string.Empty).Contains("WebResource.axd") ||
                        string.IsNullOrEmpty(i.GetAttributeValue("href", string.Empty))
                        );

                foreach (var node in scriptNodes)
                {
                    node.ParentNode.RemoveChild(node);
                }
                foreach (var node in linkNodes)
                {
                    node.ParentNode.RemoveChild(node);
                }

                return htmlDoc.DocumentNode.OuterHtml;
            }

     Don't forget to include following namespaces.

    using HtmlAgilityPack;
    using System.Text.RegularExpressions;
    using System.IO;
    using System.Linq;

    Hope it helps.

    Thanks

  6. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    01 Aug 2014 in reply to Saad
    Link to this post

    Hi  saad ,

    In sitefinity master page don't have  CodeBehind file .  I can't write it in there.

     see the atach file .

    Regards

    Minco 

     

  7. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    01 Aug 2014 in reply to minco
    Link to this post

    Hi Minco,

    You will have to use your .master file to inherit your page template from. This way you don't loose any functionality but get access to the code behind.

  8. minco
    minco avatar
    20 posts
    Registered:
    16 Jun 2014
    05 Aug 2014 in reply to Saad
    Link to this post

    Hi  Saad  ,

    Thank you very much.  It's ok now.   But I still want to know  how  to solve it by Sitefinity Team. 

8 posts, 0 answered