Using and accessing Webresource

I know this has been asked before. Yes, i did my research but it doesn't seem to be working for me so i hope you experts can help me out :)

Here's what my Project looks like

Yes, the Build Action is Embedded Resource. I also added this in the AssemblyInfo

Assembly: WebResource("WFL.WebResource.EXT.XXX.png", "image/png")

So now, in the default.aspx i say

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim cs As ClientScriptManager = Page.ClientScript
        Dim strReturn As String = cs.GetWebResourceUrl(Me.GetType(), "WFL.WebResource.EXT.XXX.png")
        Dim strReturn2 As String = cs.GetWebResourceUrl(GetType(_Default), "WFL.WebResource.EXT.XXX.png")

        Image1.ImageUrl = "http://localhost" + strReturn
        Image2.ImageUrl = "http://localhost" + strReturn2

        Response.Write("http://localhost" + strReturn)
        Response.Write("http://localhost" + strReturn2)

    End Sub

But when accessing the returned URL, i get The resource cannot be found. What am i doing wrong? Thanks in advance.


This being VB and not C#, you don't need the .EXT portion in WFL.WebResource.Ext.XXX.png. That is something C# needs (to specify folder paths), but VB doesn't. You just want your namespace then resource. Try WFL.WebResource.XXX.png and see if that works.

Need Your Help

Mule ESB : How the threads names are managed?

java multithreading websphere mule

below I posted an extraction of SystemOut.log from a websphere 7.0 with Mule ESB 3.4.0. My Mule flow is a synchronous one. It consumes "Websphere MQ messages" and log the message "Message Consume" ...

How should Iterator implementation deal with checked exceptions?

java exception-handling iterator recordset

I'm wrapping a java.sql.RecordSet inside a java.util.Iterator. My question is, what should I do in case any recordset method throws an SQLException?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.