Embed Resource. I can't figure this out.

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
 
S

shapper

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top