Solved

How to acess the folder ClientBin/XML (UriKind.Relative)

Posted on 2011-03-24
2
798 Views
Last Modified: 2013-11-12
I trying to acess the folder ClientBin/XML and I´m not getting.
      private void XML_Click(object sender, RoutedEventArgs e)
        {
            WebClient client = new WebClient();
            string _Uri = "/XML/file.xml"; >>>>>>>>> THIS NOT WORKS
            Uri uritoXML = new Uri(_Uri, UriKind.Relative);
            client.OpenReadCompleted += new OpenReadCompletedEventHandler(XML_Click_Final1);
            client.OpenReadAsync(uritoXML);
        }

I can acess the folder ClientBin.
      private void XML_Click(object sender, RoutedEventArgs e)
        {
            WebClient client = new WebClient();
            string _Uri = "file.xml"; >>>>>>>>> THIS WORKS
            Uri uritoXML = new Uri(_Uri, UriKind.Relative);
            client.OpenReadCompleted += new OpenReadCompletedEventHandler(XML_Click_Final1);
            client.OpenReadAsync(uritoXML);
        }

I can acess too by site
      private void XML_Click(object sender, RoutedEventArgs e)
        {
            WebClient client = new WebClient();
            string _Uri = @"http://mysite.com.br/ClientBin/XML/file.xml"; >>>>>>>>> THIS WORKS
            Uri uritoXML = new Uri(_Uri, UriKind.Absolute);
            client.OpenReadCompleted += new OpenReadCompletedEventHandler(XML_Click_Final1);
            client.OpenReadAsync(uritoXML);
        }

what is wrong in the first case?


Thanks

0
Comment
Question by:Plexo
2 Comments
 
LVL 3

Expert Comment

by:politex
ID: 35212919
Hi, can be two variants, path must be "/ClientBin/XML/file.xml" or you have not grant access for clients to this folder
0
 
LVL 29

Accepted Solution

by:
Gautham Janardhan earned 500 total points
ID: 35213144
private void XML_Click(object sender, RoutedEventArgs e)
        {
            WebClient client = new WebClient();
            string _Uri = "XML/file.xml";
            Uri uritoXML = new Uri(_Uri, UriKind.RelativeOrAbsolute);
            client.OpenReadCompleted += new OpenReadCompletedEventHandler(XML_Click_Final1);
            client.OpenReadAsync(uritoXML);
        }
changes i made are in bold

this shud work if the actual folder stucture is "ClientBin - > Xml -> file.xml"
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question