App_Data or App_GlobalResources

  • Thread starter Thread starter kurt sune
  • Start date Start date
K

kurt sune

This drives me nuts,I have put a textfile in App_GlobalResources.

How do I read it in runtime? I have googled for two days now.

GetExecutingAssembly.GetManifestResourceStream("XYZ.xml") returns nothing.

Should I put it in App_Data instead?

How do I read it from there?

/k
 
re:
This drives me nuts,I have put a textfile in App_GlobalResources.

App_GlobalResources is hard-wired for .resx files.

The files in App_GlobalResources are compiled into a namespace called Resources.

For each resource (string, image) in any resource file in App_GlobalResources,
ASP.NET will dynamically generate the static property for each.

re:
Should I put it in App_Data instead?
Yes.

re:
How do I read it from there?

Dim rdr As StreamReader = File.OpenText ("App_Data/a.txt")
or
Dim rdr As StreamReader = New StreamReader( File.Open("App_Data/a.txt", FileMode.Open))

Then you can loop through the rows to get all the text.

Frankly, I'd write an xml file and place it in App_Data, instead of using a plain-text file.
It's far easier to get specific bits of info from an xml file than from a text file.

Good luck!



Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top