{"id":28,"date":"2006-05-10T22:29:29","date_gmt":"2006-05-10T20:29:29","guid":{"rendered":"http:\/\/soci.hu\/blog\/index.php\/2006\/05\/10\/working-with-web-resources-in-aspnet-20\/"},"modified":"2006-05-10T22:37:32","modified_gmt":"2006-05-10T20:37:32","slug":"working-with-web-resources-in-aspnet-20","status":"publish","type":"post","link":"https:\/\/soci.hu\/blog\/index.php\/2006\/05\/10\/working-with-web-resources-in-aspnet-20\/","title":{"rendered":"Working with Web Resources in ASP.NET 2.0"},"content":{"rendered":"<p>A t\u00e9ma tal\u00e1n nem annyira ismer\u0151s, ez\u00e9rt vettem el\u0151. Arr\u00f3l sz\u00f3l a WebResource t\u00e9mak\u00f6r, hogy ha egy ASP.NET Controlnak sz\u00fcks\u00e9ge van p\u00e1r kieg\u00e9sz\u00edt\u0151 f\u00e1jlra, pl. cssre vagy k\u00e9pekre, akkor azokat \u00e1gyazzuk bele er\u0151forr\u00e1sk\u00e9nt az osszombliba, mert akkor nem v\u00e9sz el (t\u00e9nyleg).<\/p>\n<p>Csakhogy a komponensb\u0151l bin\u00e1ris folyamk\u00e9nt kellene valahogy eljuttatni a cuccot a b\u00f6ng\u00e9sz\u0151kh\u00f6z, ehhez viszont kellene egy HttpHandler.<\/p>\n<p>Szerencs\u00e9re nem kell ilyet \u00edrni, pont erre a c\u00e9lra van ilyen k\u00e9szen, a WebResource.axd k\u00e9p\u00e9ben. Az er\u0151forr\u00e1st a ford\u00edt\u00f3 be\u00e1gyazza a komponensbe, azt\u00e1n csak meg kell jel\u00f6lni mit szeretn\u00e9nk ezek k\u00f6z\u00fcl publik\u00e1lni:<\/p>\n<p>[assembly: WebResource(&#8220;SimpleControl.smallFail.gif&#8221;, &#8220;image\/gif&#8221;)]<\/p>\n<p>A lapb\u00f3l pedig \u00edgy lehet let\u00f6lteni a tartalmat:<\/p>\n<p>ClientScriptManager cs = Page.ClientScript;<br \/>\nType rsType = this.GetType();<br \/>\nimgTest.ImageUrl = cs.GetWebResourceUrl(rsType, &#8220;SimpleControl.smallFail.gif&#8221;);<\/p>\n<p>El\u00e9g egyszer\u0171, nem?<\/p>\n<p>Az er\u0151forr\u00e1s egy\u00e9bk\u00e9nt valami ilyesmi urlen lesz majd el\u00e9rhet\u0151:<\/p>\n<p>WebResource.axd?d=SbXYsCenzoredXW&#038;t=6330078<br \/>\nA v\u00e9g\u00e9n a t egy timestamp, cache-el\u00e9s miatt.<\/p>\n<p>Az eg\u00e9sz csak az\u00e9rt jutott az eszembe, mert j\u00f6tt az aktu\u00e1lis KB \u00e9rtes\u00edt\u0151 a <a href=\"http:\/\/www.kbalertz.com\/\">http:\/\/www.kbalertz.com<\/a>\u00a0-r\u00f3l, \u00e9s abban l\u00e1ttam egy <a href=\"http:\/\/www.kbalertz.com\/Feedback_910442.aspx\" target=\"_blank\">\u00faj cikket<\/a> a t\u00e9m\u00e1ban.<\/p>\n<p>A szerz\u0151 viszont egy \u00e9vtizeddel lemaradt, aki belen\u00e9z a cikkbe meg fogja l\u00e1tni mi\u00e9rt. Ekkora nyilv\u00e1nval\u00f3 baroms\u00e1got hogy adnak ki? Am\u00fagy j\u00f3 a cikk, egy eszement h\u00fclyes\u00e9get lesz\u00e1m\u00edtva.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A t\u00e9ma tal\u00e1n nem annyira ismer\u0151s, ez\u00e9rt vettem el\u0151. Arr\u00f3l sz\u00f3l a WebResource t\u00e9mak\u00f6r, hogy ha egy ASP.NET Controlnak sz\u00fcks\u00e9ge van p\u00e1r&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[],"class_list":["post-28","post","type-post","status-publish","format-standard","hentry","category-net","category-szakmai-elet"],"_links":{"self":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/28","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/comments?post=28"}],"version-history":[{"count":0,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/posts\/28\/revisions"}],"wp:attachment":[{"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/media?parent=28"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/categories?post=28"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/soci.hu\/blog\/index.php\/wp-json\/wp\/v2\/tags?post=28"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}