473,670 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

embedded resource

Hi

Im creating my first 2.0 site and I cant find the Build Action property? I
want to embedd an image-file in my site-assembly but I don't know how? In
1.1 I could set Build Action to Embedded Resource in the properties pane but
this doesn't seem to be available any more???

/Andreas
Jan 6 '06 #1
8 6074
Hi,

ASP.NET does not build assemblies with resources exaclty similarly as it did
in ASP.NET 1.1 (unless you start to use web application projects see
http://webproject.scottgu.com)

Now, you'd add a resource file to App_GlobalResou rces directory (special
directory for ASP.NET 2.0) and add the image as a resource to that resource
file.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Andreas Zita" <an**********@g mail.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi

Im creating my first 2.0 site and I cant find the Build Action property? I
want to embedd an image-file in my site-assembly but I don't know how? In
1.1 I could set Build Action to Embedded Resource in the properties pane
but this doesn't seem to be available any more???

/Andreas

Jan 6 '06 #2
Aha I see... interresting. Previously I used to embedd layout images/icons
and retrieve them with a custom aspx-request and a resource-id such as:
..../GetResource.asp x?id=HeaderBack ground. Im building my html-pages with XSL
(HTMLWriter to Response.Output ) so I need URL:s to my resources. Is there a
similar built in method to retrieve resources that have been embedded in a
resx-file in 2.0?

/Andreas
ASP.NET does not build assemblies with resources exaclty similarly as it
did in ASP.NET 1.1 (unless you start to use web application projects see
http://webproject.scottgu.com)

Now, you'd add a resource file to App_GlobalResou rces directory (special
directory for ASP.NET 2.0) and add the image as a resource to that
resource file.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Jan 6 '06 #3
I don't know what you mean but:

1) Create the folder as suggested.
2) Add a textfile like text1.txt (for testing)
3) Add the resource.resx
4) The pane is shown, drag the text1.text on this resource pane.
5) You should see a pretty large image with title.
6) In your source use: ... resources.resou rce.text1.tostr ing

That's it.


"Andreas Zita" <an**********@g mail.com> schreef in bericht
news:OW******** *******@TK2MSFT NGP10.phx.gbl.. .
Aha I see... interresting. Previously I used to embedd layout images/icons
and retrieve them with a custom aspx-request and a resource-id such as:
.../GetResource.asp x?id=HeaderBack ground. Im building my html-pages with
XSL (HTMLWriter to Response.Output ) so I need URL:s to my resources. Is
there a similar built in method to retrieve resources that have been
embedded in a resx-file in 2.0?

/Andreas
ASP.NET does not build assemblies with resources exaclty similarly as it
did in ASP.NET 1.1 (unless you start to use web application projects see
http://webproject.scottgu.com)

Now, you'd add a resource file to App_GlobalResou rces directory (special
directory for ASP.NET 2.0) and add the image as a resource to that
resource file.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Jan 6 '06 #4
Okey ... Anyhow ... Is this right?: xsl-files in App_GlobalResou rces always
embeds but in App_LocalResour ce they don't?
And ... how do I retrieve an embedded Stylesheet from App_GlobalResou rces ?

Thanks for your help! :)

/Andreas

"Edwin Knoppert" <ne**@hellobasi c.com> skrev i meddelandet
news:43******** *************** @text.nova.plan et.nl...
I don't know what you mean but:

1) Create the folder as suggested.
2) Add a textfile like text1.txt (for testing)
3) Add the resource.resx
4) The pane is shown, drag the text1.text on this resource pane.
5) You should see a pretty large image with title.
6) In your source use: ... resources.resou rce.text1.tostr ing

That's it.

Jan 6 '06 #5
Hi,

sure, these are called web resources and you can generate the call needed to
fetch them.

Here's link to tutorial:
http://www.asp.net/QuickStart/aspnet...bility.aspx#WR

But basically, you specify it to be a web resource with WebResource
attribute and access it with Page.ClientScri pt.GetWebResour ceUrl () call.

And here's a good article on the subject
http://aspalliance.com/726

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

"Andreas Zita" <an**********@g mail.com> wrote in message
news:OW******** *******@TK2MSFT NGP10.phx.gbl.. .
Aha I see... interresting. Previously I used to embedd layout images/icons
and retrieve them with a custom aspx-request and a resource-id such as:
.../GetResource.asp x?id=HeaderBack ground. Im building my html-pages with
XSL (HTMLWriter to Response.Output ) so I need URL:s to my resources. Is
there a similar built in method to retrieve resources that have been
embedded in a resx-file in 2.0?

/Andreas
ASP.NET does not build assemblies with resources exaclty similarly as it
did in ASP.NET 1.1 (unless you start to use web application projects see
http://webproject.scottgu.com)

Now, you'd add a resource file to App_GlobalResou rces directory (special
directory for ASP.NET 2.0) and add the image as a resource to that
resource file.

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke


Jan 6 '06 #6
Hi and thanks for replying ... but I still dont understand... for instance
in the second url they where pointing to the Build Action property which
isnt available anymore (?) ...

I am aware of that it isnt easy to understand what my problem really is... i
dont know for sure myself ... anyhow ... This is what I have come up with:

I have placed all my image-files in the App_GlobalResou rces-folder and added
them to a Images.resx file in the same folder. Then I created a aspx-file
for retrieving these images as the code below shows. Is this approach sane?
or is there some other more common method I have missed?

public partial class ASP_GetResource : System.Web.UI.P ag
{
protected void Page_Load(objec t sender, EventArgs e)
{
System.Drawing. Bitmap image = GetGlobalResour ceObject("Image s",
ResourceKey) as System.Drawing. Bitmap;
Response.Conten tType = "image/gif";
image.Save(Resp onse.OutputStre am, System.Drawing. Imaging.ImageFo rmat.Gif);
image.Dispose() ;
}

string ResourceKey { get { return Request.QuerySt ring["res"]; }}
}

/Andreas
Hi,

sure, these are called web resources and you can generate the call needed
to fetch them.

Here's link to tutorial:
http://www.asp.net/QuickStart/aspnet...bility.aspx#WR

But basically, you specify it to be a web resource with WebResource
attribute and access it with Page.ClientScri pt.GetWebResour ceUrl () call.

And here's a good article on the subject
http://aspalliance.com/726

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Jan 6 '06 #7
> in the second url they where pointing to the Build Action property which
isnt available anymore (?) ...
It is, if you built components into external class library. Writing a class
library is still there (though not with VWD express).That example just point
to such.
I am aware of that it isnt easy to understand what my problem really is...
i dont know for sure myself ... anyhow ... This is what I have come up
with:

I have placed all my image-files in the App_GlobalResou rces-folder and
added them to a Images.resx file in the same folder. Then I created a
aspx-file for retrieving these images as the code below shows. Is this
approach sane? or is there some other more common method I have missed?


That works fine. There's also the Web resource mechanism, in which Page
framework provides you the URl to the resource automatically, e-g
autogenerates it so that resource is served from resource files on the fly.

For example you'd just give:

Image1.ImageUrl =
Page.ClientScri pt.GetWebResour ceUrl(this.GetT ype(),"myimage. gif")

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
Jan 6 '06 #8
Just to add that web resource scenario would require the external class
library.

Teemu

"Teemu Keiski" <jo****@aspalli ance.com> wrote in message
news:eH******** ******@TK2MSFTN GP11.phx.gbl...
in the second url they where pointing to the Build Action property which
isnt available anymore (?) ...


It is, if you built components into external class library. Writing a
class library is still there (though not with VWD express).That example
just point to such.
I am aware of that it isnt easy to understand what my problem really
is... i dont know for sure myself ... anyhow ... This is what I have come
up with:

I have placed all my image-files in the App_GlobalResou rces-folder and
added them to a Images.resx file in the same folder. Then I created a
aspx-file for retrieving these images as the code below shows. Is this
approach sane? or is there some other more common method I have missed?


That works fine. There's also the Web resource mechanism, in which Page
framework provides you the URl to the resource automatically, e-g
autogenerates it so that resource is served from resource files on the
fly.

For example you'd just give:

Image1.ImageUrl =
Page.ClientScri pt.GetWebResour ceUrl(this.GetT ype(),"myimage. gif")

--
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke

Jan 6 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
24167
by: james | last post by:
What class / method should I be using to get the full path to an embedded resource ? In my case I have an .xml file that my app uses, it is set as embedded resource, and I have a control that needs to load it, but I do not want to hard code the path since that may change for different installs. i.e. GetPathForResourceOfName ( myResourceFileName ) thanks, JIM
5
8222
by: Drew | last post by:
Assembly asm = Assembly.GetExecutingAssembly(); me = new Bitmap(asm.GetManifestResourceStream("me.gif")); I have used this before without any problem, but now I get: An unhandled exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: 'null' is not a valid value for 'stream'.
1
2937
by: n! | last post by:
I have an irritating problem with VS.NET2003, C#. I wrote some code that would build my application menu from an XML resource file. Purely to make it easy for me to edit, so I've added this file as an embedded resource. My irritation, is that when I update the resource file and nothing else. VS does not build the project with the newly edited resource file. So if I run the application again, it actually hasn't been updated to use my newly...
2
1887
by: Kyle Kaitan | last post by:
I have an assembly (AppResources.dll) which contains a number of embedded resource files. Most of these are key/value pairs of relevant strings; a few are images and sounds; some more are XML files. My application will load the resources into memory as they are needed. I would like to be able to read and write to these embedded resources. Is it possible to write to an embedded resource within an assembly? If so, how? If it's not...
0
1629
by: ATS | last post by:
HOWTO Make a UserControl deploy an embedded resource. Please help, I need to embed an EXE into a C# UserControl that is run from script in an HTML web page as such: <html> <object id=objTest
0
2190
by: Johann Blake | last post by:
I'm having trouble grasping how ASP.NET correctly locates resources. There is plenty of documentation on this subject but some things are not clear at all. In my ASP.NET application, I have multiple web forms. When you compile the application, it creates a DLL. If you view this DLL using ILDASM (the manifest), it shows info about the resources stored in the DLL. There is essentially an embedded resource "section" for each web form. The...
4
4404
by: Jason Pettys | last post by:
In an ASP.NET project I am setting the content type of my .ascx and ..aspx files to Embedded Resource for a separate reason. When I do this they get embedded as "RootNamespace.Filename" but I would like them to be embedded as "RootNamespace.Folder.Filename". I see that the .resources files are embedded with the containing folder information in the namespace, and I think c# projects work this way, too. Is there any way (a vbc command...
3
9803
by: raghu sunkara | last post by:
Hi, How Can i Change or Modify Embedded String Resource In An Assembly. I Need To Modify Embedded String Resource In An Assembly. Please Help Me. Thanks Raghu.
2
2413
Frinavale
by: Frinavale | last post by:
I am attempting to use embedded resources in an Ajax Enabled ASP.NET Web Application. I'm using Visual Studio 2008 and VB.NET server side code. The project is called "EmbeddedResources" with the namespace "EmbeddedResources" My resources are not included when the content is rendered in the browser. I have marked my JavaScript resource as Embedded. I am able to retrieve the path to the resource from the WebResource.axd HTTP Handler during...
2
8722
by: steve | last post by:
I have the following routine for retrieving error message strigs from a resource file which is embedded in the project. But when it is called I get the error messsage "Could not find any resources.." shown underneath the code. The error message indicates that it is looking for resource ResourceExceptions.resource which is not what was embedded in the code by Visual Studio. The resource file is ResourceExceptions.resx. If I try to change...
0
8903
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8815
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8592
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8661
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6216
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4213
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2802
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2044
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1795
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.