[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 817
  • Last Modified:

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

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
Plexo
Asked:
Plexo
1 Solution
 
politexCommented:
Hi, can be two variants, path must be "/ClientBin/XML/file.xml" or you have not grant access for clients to this folder
0
 
Gautham JanardhanCommented:
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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now