Embed Resource. I can't figure this out.

  • Thread starter Thread starter shapper
  • Start date Start date
S

shapper

Hello,

I have an assembly with customs controls, classes and handlers.I am
creating it as an ASP.NET 2.0 VS2005 Web Project

This one one of my handlers:

Namespace Web

Public Class SiteMap : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext)
Implements IHttpHandler.ProcessRequest

Dim xslDoc As XslCompiledTransform = New XslCompiledTransform
xslDoc.Load(Page.ClientScript.GetWebResourceUrl(Me.GetType,
"MyProjectNamespace.Web.SiteMap.xsl")) >>> ERROR

End Sub
...

I get the error "Page is not declared".

I also have the code line "<Assembly:
System.Web.UI.WebResource("MyProjectNamespace.Web.SiteMap.xsl",
"text/xml")> " in my AssemblyInfo.vb file.

And I set the Build Action of "SiteMap.xsl" to "Embedded Resource".

I have been reading documentation in internet but I can't find the
solution.

Could someone help me out?

Thank You,

Miguel
 
Hi,

I followed your example and I get an error:

Value cannot be null.
Parameter name: stylesheet

Maybe I am using this wrong?

My project namespace is: MyNM

I am using my resource file in:

----------------------
Namespace Web

Public Class SiteMap : Implements IHttpHandler

Public Sub ProcessRequest(ByVal context As HttpContext)
Implements IHttpHandler.ProcessRequest

Dim a As System.Reflection.Assembly = Me.GetType().Assembly
Dim s As Stream =
a.GetManifestResourceStream("MyNM.Web.SiteMap.xsl")
----------------------

My SiteMap.xsl is in a folder inside my project named "Assets/Web/"

In my AssemblyInfo.vb I have:

<Assembly: System.Web.UI.WebResource("MyNM.Web.SiteMap.xsl",
"text/xml")>

Am I doing something wrong?

Thanks,

Miguel
 
Back
Top