M
mohit
Hi,
I am creating a web application in Web Matrix on the .NET
framework.
I have two directories :AddUser and FormAuth in a Directory P.
AddUser contains a file AddUser.aspx
FormAuth contains : Default.aspx , Users.xml , Login.aspx
I have the following code :
DataSet ds = new DataSet();
String userFile = "../Users.xml";
FileStream fs = new FileStream(Server.MapPath(userFile),
FileMode.Open,FileAccess.Read);
StreamReader reader = new StreamReader(fs);
ds.ReadXml(reader);
fs.Close();
When I run it it gives the following exception :
[HttpException (0x80004005): Cannot use a leading .. to exit above the
top directory.]
System.Web.Util.UrlPath.Reduce(String path) +581
System.Web.Util.UrlPath.Combine(String basepath, String relative)
+251
System.Web.HttpRequest.MapPath(String virtualPath, String
baseVirtualDir, Boolean allowCrossAppMapping) +192
System.Web.HttpServerUtility.MapPath(String path) +61
ASP.AddUser_aspx.Button1_Click(Object sender, EventArgs e) in F:\DC
Downlaods(complete)\mohitag\MyProject\AddUser\AddUser.aspx:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1263
IF YOU HAVE SOME IDEA PLEASE TELL ME AS SOON AS POSSIBLE.
Thank you very much
I am creating a web application in Web Matrix on the .NET
framework.
I have two directories :AddUser and FormAuth in a Directory P.
AddUser contains a file AddUser.aspx
FormAuth contains : Default.aspx , Users.xml , Login.aspx
I have the following code :
DataSet ds = new DataSet();
String userFile = "../Users.xml";
FileStream fs = new FileStream(Server.MapPath(userFile),
FileMode.Open,FileAccess.Read);
StreamReader reader = new StreamReader(fs);
ds.ReadXml(reader);
fs.Close();
When I run it it gives the following exception :
[HttpException (0x80004005): Cannot use a leading .. to exit above the
top directory.]
System.Web.Util.UrlPath.Reduce(String path) +581
System.Web.Util.UrlPath.Combine(String basepath, String relative)
+251
System.Web.HttpRequest.MapPath(String virtualPath, String
baseVirtualDir, Boolean allowCrossAppMapping) +192
System.Web.HttpServerUtility.MapPath(String path) +61
ASP.AddUser_aspx.Button1_Click(Object sender, EventArgs e) in F:\DC
Downlaods(complete)\mohitag\MyProject\AddUser\AddUser.aspx:28
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +83
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1263
IF YOU HAVE SOME IDEA PLEASE TELL ME AS SOON AS POSSIBLE.
Thank you very much