Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Upgrading DNN P...Upgrading DNN P...Dotnetnuke Web site Migration from ASP.NET 3.5 to 4.0 FrameworkDotnetnuke Web site Migration from ASP.NET 3.5 to 4.0 Framework
Previous
 
Next
New Post
9/29/2010 9:26 AM
 
Hi To ALL,

I am using Visual Studio 2010 with framework 4.0, facing an strange exception.  :-

The type or namespace name 'SecurityRulesAttribute' does not exist in the namespace 'System.Security' (are you missing an assembly reference?)

 when I execute Load Statement :-

 XslCompiledTransform xslt = new XslCompiledTransform();

 xslt.Load(MyXSLTFile, xslt_settings, new XmlUrlResolver());

 

The "MyXSLTFile" is an XSLT file contains a C# function as shown below:-

<ms:script language="C#" implements-prefix="user">

                                <![CDATA[  

  public string GetFileIconURL(string FileName, string FileExtensionsConfigurationURL)

  {

      string FileExtension = System.IO.Path.GetExtension(FileName);

      XPathDocument xmldoc = new XPathDocument(FileExtensionsConfigurationURL);

      XPathNavigator nav = xmldoc.CreateNavigator();

      XPathExpression expr;

      expr = nav.Compile(@"/FileIcons/FileExtension[@ID='" + FileExtension + "']/@src");

      XPathNodeIterator iterator = nav.Select(expr);

      iterator.MoveNext();

      return iterator.Current.Value;  

  }

  ]]>

 </ms:script>

where "User" is used in

<xsl:otherwise>

<img ID="{$matchedfile}" src="{ User:GetFileIconURL($matchedfile,$FileExtensionsConfigurationURL)}" width="{$imageWidth}" height="{$imageHeight}" border="0" align="top" />

</xsl:otherwise>

This code is working fine in previous framework version 3.5. I have'nt used any Security Policy or set any Security Levels in my Website

Not able to understand why is it giving this Problem.

Please help if any one have any idea about that.

Regards,

Hitesh Panchal

 
New Post
9/29/2010 11:00 AM
 
please update to latest version of XML/XSL module

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
9/30/2010 2:06 AM
 

Hi Sebastian Leupold,

 

Thanks for your support.

 

I am not using XML or XSL Module of the Dotnetnuke.

 

I have created one "XSLTTransformation.aspx" page in Dotnetnuke. In this page, i have write below code to Transform XML file into HTML using XSLT file.

 

C# Code:

string strGenereatedxml = @"D:\Test.XML";

string strHTML;

string strXSLFIle = @"D:\TestTranform.xslt";

XslCompiledTransform x = new XslCompiledTransform();

 

XmlDocument docxml = new XmlDocument();

docxml.LoadXml(strGenereatedxml);

System.IO.MemoryStream mStream = new MemoryStream(System.Text.Encoding.UTF8.GetBytes(strGenereatedxml));

XPathDocument xpathdoc = new XPathDocument(mStream);

 

XsltSettings xslt_settings = new XsltSettings();

xslt_settings.EnableScript = true;

xslt_settings.EnableDocumentFunction = true;

 

XslCompiledTransform xslt = new XslCompiledTransform();

xslt.Load(strXSLFile, xslt_settings, new XmlUrlResolver());

 

MemoryStream ms = new MemoryStream();

XmlTextWriter writer = new XmlTextWriter(ms, System.Text.Encoding.ASCII);

StreamReader rd = new StreamReader(ms);

 

XsltArgumentList argslst = new XsltArgumentList();

argslst.AddParam("strsubFolder", "", strsubFolder);

 

xslt.Transform(xpathdoc, argslst, writer);

ms.Position = 0;

strHTML = rd.ReadToEnd();

 

rd.Close();

ms.Close();

 

 

XSLT Code:

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet

 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

 xmlns:msxsl="urn:schemas-microsoft-com:xslt"

 xmlns:ms="urn:schemas-microsoft-com:xslt"

 xmlns:user="urn:my-scripts"

 version="1.0">

                <xsl:output method="html" indent="no"/>

<xsl:template match="/">

<html>

<img ID="{$matchedfile}" src="{user:GetFileIconURL($matchedfile,$FileExtensionsConfigurationURL)}" width="{$imageWidth}" height="{$imageHeight}" border="0" align="top" ondragstart="fnGetSource();" draggesture="cancelevent();" name="{$strsubFolder}" />

</html>

</xsl:template>

<ms:script language="C#" implements-prefix="user">

                                <![CDATA[

  

  public string GetFileIconURL(string FileName, string FileExtensionsConfigurationURL)

  {

      string FileExtension = System.IO.Path.GetExtension(FileName);

      XPathDocument xmldoc = new XPathDocument(FileExtensionsConfigurationURL);

      XPathNavigator nav = xmldoc.CreateNavigator();

      XPathExpression expr;

      expr = nav.Compile(@"/FileIcons/FileExtension[@ID='" + FileExtension + "']/@src");

      XPathNodeIterator iterator = nav.Select(expr);

      iterator.MoveNext();

      return iterator.Current.Value;  

  }

 

  ]]>

                </ms:script>

 

</xsl:stylesheet>

 

 

NOTE - when i remove C# code from XSLT Code so it works fine otherwise it gives error. It works successfully in 3.5 Framework.

 

Please help me on this issue.

 

Regards,

Hitesh Panchal

 

 
New Post
9/30/2010 3:30 AM
Accepted Answer 
Hi To ALL,

I have resolved my problem.

In asp.net 4.0, we can not add write directly C# code into XSLT.

we have to pass Object of Class file using "ADDEXTENSIONOBJECT" method of ArgumentList of XSLT. check below URL from more detail...

http://msdn.microsoft.com/en-us/library/system.xml.xsl.xsltargumentlist.addextensionobject.aspx

Thanks guys !!!

any one need more help then mail me on this ID : hitspanchal01@yahoo.com

Regards,
Hitesh Panchal
 
New Post
9/30/2010 4:10 AM
 
great you figured it out :)

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Upgrading DNN P...Upgrading DNN P...Dotnetnuke Web site Migration from ASP.NET 3.5 to 4.0 FrameworkDotnetnuke Web site Migration from ASP.NET 3.5 to 4.0 Framework


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out