473,386 Members | 1,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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 6056
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_GlobalResources 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**********@gmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.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.aspx?id=HeaderBackground. 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_GlobalResources 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.resource.text1.tostring

That's it.


"Andreas Zita" <an**********@gmail.com> schreef in bericht
news:OW***************@TK2MSFTNGP10.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.aspx?id=HeaderBackground. 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_GlobalResources 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_GlobalResources always
embeds but in App_LocalResource they don't?
And ... how do I retrieve an embedded Stylesheet from App_GlobalResources ?

Thanks for your help! :)

/Andreas

"Edwin Knoppert" <ne**@hellobasic.com> skrev i meddelandet
news:43***********************@text.nova.planet.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.resource.text1.tostring

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.ClientScript.GetWebResourceUrl () 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**********@gmail.com> wrote in message
news:OW***************@TK2MSFTNGP10.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.aspx?id=HeaderBackground. 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_GlobalResources 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_GlobalResources-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.Pag
{
protected void Page_Load(object sender, EventArgs e)
{
System.Drawing.Bitmap image = GetGlobalResourceObject("Images",
ResourceKey) as System.Drawing.Bitmap;
Response.ContentType = "image/gif";
image.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);
image.Dispose();
}

string ResourceKey { get { return Request.QueryString["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.ClientScript.GetWebResourceUrl () 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_GlobalResources-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.ClientScript.GetWebResourceUrl(this.GetType() ,"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****@aspalliance.com> wrote in message
news:eH**************@TK2MSFTNGP11.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_GlobalResources-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.ClientScript.GetWebResourceUrl(this.GetType() ,"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
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...
5
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...
1
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...
2
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...
0
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...
0
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...
4
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...
3
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
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...
2
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.