Hi,

I'm trying to create a webservice but I'm not very familiar with them and I'm having some issues getting code from a windows form into a webapplication that I now want to use. It's just a dictionary that I want to use with a webservice. This is the code

private Dictionary<string, string> _dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
        protected void Page_Load(object sender, EventArgs e)
        {
            using (var reader = new StreamReader(File.OpenRead(@"C:/dictionary.csv")))
            {
                while (!reader.EndOfStream)
                {
                    string[] tokens = reader.ReadLine().Split(';');
                    _dictionary[tokens[0]] = tokens[1];
                }
            }
        }

and I've tried every way I can think of to get it to work with a webservice but nothing is working. Can anyone point me in the right direction? This is the only part of my code that I can't get to work.

Jadex

What exactly is it that isn't working? How do you want it to work?

WebServices aren't WinForms applications so you should not treat them as such. I notice that the code you want is in the Page_Load. Are you wanting this code to run when the WebService starts up, at the beginning of each call or is it a call by itself?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.