App_Data or App_GlobalResources

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
 
J

Juan T. Llibre

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!
 

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

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top