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.