reading .resx files
Posted on 2002-05-27
when creating a .aspx page, VS.NET adds to it a .resx file (e.g. Default.aspx.resx).
i added names/values of error codes in the .resx file - name contains a code number, and values contains error message.
in the codebehind for the Default.aspx page, i use the following to open the file for reading:
ResourceReader objResourceReader = new ResourceReader(strWebRootPath + "Default.aspx.resx");
however, i keep getting this error:
Stream is not a valid resource file!
i have even tried this with .resx files containing no keys/values, and still get the same error.
is it because i should be using ResXResourceReader class?
if so, why can't i instance it in the codebehind?!?! VS.NET compiler complains it does not exist in System.Resources... why?
any way... please advise on how to solve this problem and read from these files the keys/values i have created.