i m developing an app in windows phone 7 in which i need to read a text file. i write a code for that but when i debug that code, it gives an error "method access exception". same code is working in c# windows form app. i dont know what is the problem. plz suggest me for this and solve this problem. my code is like this:
namespace fileread
{
public partial class MainPage : PhoneApplicationPage
{
private string line;
// Constructor
public MainPage()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
StreamReader sr = new StreamReader(@"D:\abc.txt");
line = sr.ReadLine();
MessageBox.Show(line);
}
Error occured at line: "line = sr.ReadLine();"