views:

367

answers:

1

Are there any ways to programmatically extract an embedded resource instead of going through the WebResource.axd handler? I have the two parameters (d & t) that are passed to the WebResource.axd handler. I'm hoping there's a way I can use those parameters to extract the resource myself. Any tips are appreciated, thanks.

+1  A: 

You can use the Assembly class. The code below returns an embedded resource as a stream from the current assembly:

using System.Reflection;

Assembly assembly = Assembly.GetExecutingAssembly();
Stream stream = assembly.GetManifestResourceStream("YourEmbeddedResource");
antscode
Thanks, but two issues. (1) The resource is in most cases going to be one of the ASP.NET scripts where JS functions like WebForm_PostBackOptions() are defined. Do you know which assembly that would be in? (2) I don't have the embedded resource name, just the "d" and "t" values, which are rather cryptic values that I believe are different than the embedded resource name.
Ben Amada
Those scripts are in the System.Web.dll assembly. You can use Reflector to find their names.
korchev