Solved

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

Posted on 2011-03-24
2
811 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

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

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
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…
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…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

707 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