Solved

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

Posted on 2011-03-24
2
785 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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
.NET Error 7 42
Need to Modify a Script I found 5 75
String manipulation 15 49
Redacting a row in Excel based on a term. 17 31
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
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 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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now