Reading an embedded file from an ASP.NET Custom Server Control an rendering it
- by Andreas Grech
I currently have a file "abc.htm" in my Custom Server Control Project and it's Build Action is set to Embedded Resource.
Now in the RenderContents(HtmlTextWriter output) method, I need to read that file and render it on the website.
I am trying the following but it's to no avail:
protected override void RenderContents(HtmlTextWriter output)
{
var providersURL = Page.ClientScript.GetWebResourceUrl(typeof (OpenIDSel), "OpenIDSelector.Providers.htm");
var fi = new FileInfo(providersURL); // <- exception here
//the remaining code is to possibly render the file
}
This is an example of how the providersURL is:
/WebResource.axd?d=kyU2OiYu6lwshLH4pRUCUmG-pzI4xDC1ii9u032IPWwUzMsFzFHzL3veInwslz8Y0&t=634056587753507131
FileInfo is throwing System.ArgumentException: Illegal characters in path.