Home All Groups Group Topic Archive Search About
Author
6 Jan 2006 11:14 AM
Andreas Zita
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

Author
6 Jan 2006 12:09 PM
Teemu Keiski
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

Show quoteHide quote
"Andreas Zita" <andreas.z***@gmail.com> wrote in message
news:%231z3oJrEGHA.2196@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
>
Are all your drivers up to date? click for free checkup

Author
6 Jan 2006 12:49 PM
Andreas Zita
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

Show quoteHide quote
> 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
Author
6 Jan 2006 1:33 PM
Edwin Knoppert
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.




Show quoteHide quote
"Andreas Zita" <andreas.z***@gmail.com> schreef in bericht
news:OW$nv%23rEGHA.272@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
>
>
Author
6 Jan 2006 1:52 PM
Andreas Zita
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

Show quoteHide quote
"Edwin Knoppert" <n***@hellobasic.com> skrev i meddelandet
news:43be721d$0$10082$ba620dc5@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.
Author
6 Jan 2006 2:03 PM
Teemu Keiski
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/doc/extensibility.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

Show quoteHide quote
"Andreas Zita" <andreas.z***@gmail.com> wrote in message
news:OW$nv%23rEGHA.272@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
>
>
Author
6 Jan 2006 3:35 PM
Andreas Zita
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

Show quoteHide quote
> 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/doc/extensibility.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
Author
6 Jan 2006 7:35 PM
Teemu Keiski
> 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
Author
6 Jan 2006 7:37 PM
Teemu Keiski
Just to add that web resource scenario would require the external class
library.

Teemu

Show quoteHide quote
"Teemu Keiski" <jot***@aspalliance.com> wrote in message
news:eHTxbhvEGHA.1464@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
>
>

Bookmark and Share