Please Help me this BASIC error : i m new to asp.net

Posted by Sakthi.Singaravel under ASP.NET on 5/17/2012 | Points: 10 | Views : 1686 | Status : [Member] | Replies : 14
An unhandled exception occurred during the execution of the current web request...

please refer attach file and giv the solution...

i m new to ASP .Net

Regards,
Singaravel M



Responses

Posted by: Sheonarayan on: 5/17/2012 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
Looks like books.xml file doesn't exists. You should give the path from the root something like below

Server.MapPath(~/books.xml")


Assuming that books.xml file is in the root of your application.

Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/17/2012 [Member] Silver | Points: 25

Up
0
Down
Thank u Mr.Sheo Narayan

I will try it..

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/17/2012 [Member] Silver | Points: 25

Up
0
Down
now also the same error occurs...

HttpContext.Current.Server.MapPath means which location...?

(See Attachment...)

In Attached figure is correct...?
 Download source file

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kkdubey on: 5/18/2012 [Member] Starter | Points: 25

Up
0
Down
Are you coding this class file in separate project?

If yes, add reference to System.Web for this project.

Right click your Project --> add REference --> System.Web

Regards
Krishna

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/18/2012 [Member] Silver | Points: 25

Up
0
Down
The same project

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/19/2012 [Member] Silver | Points: 25

Up
0
Down
Any one Help me

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhiram on: 5/19/2012 [Member] Starter | Points: 25

Up
0
Down
HttpContext.Current.Server.MapPath returns the physical path for a given virtual path.

Phisical path means-Path of your application in Inetpub\wwwroot .Ex: C:\Inetpub\wwwroot\Test\defaut.html

Virtaul Path means : /Test/default.html

So I think the error in ur case error is becoz of the xml path ur giving.

Try it like this..

FilePath = Server.MapPath("~/FolderName/Books.xml");



Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/20/2012 [Member] Silver | Points: 25

Up
0
Down
Hi Madhu Lika,

I am also stored that XML in same place..
(See this attachment)
 Download source file

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhiram on: 5/20/2012 [Member] Starter | Points: 25

Up
0
Down
Even though books.xml is in ur project folder u should use ~ symbol like this

string physicalPath = Server.MapPath("~/Books.xml");

Also I didn't not get why ur assigning the return value to the text property of xml.
First check whether ur getting the physical path correctly r not..Then u can make use of it.

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/21/2012 [Member] Silver | Points: 25

Up
0
Down
This is the my first asp .net program..

i m getting this pgm from http://www.developerfusion.com/code/2518/how-to-validate-an-xml-file-with-an-xsd-file/

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Santhiram on: 5/21/2012 [Member] Starter | Points: 25

Up
0
Down
Ok..The program in the above link is trying to validate the XML file using a schema file.Did u load the xsd file into ur projectfolder?

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/21/2012 [Member] Silver | Points: 25

Up
0
Down
ya..
loaded..
(refer Attached figure)
 Download source file

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 5/22/2012 [Member] Starter | Points: 25

Up
0
Down
string location= Server.MapPath("~/FolderName/Books.xml");

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sakthi.Singaravel on: 5/22/2012 [Member] Silver | Points: 25

Up
0
Down
Thank u guys..
I tried it from 17-05-2012; but i can't.. so leave to learn asp.net..

Regards,
Singaravel M

Sakthi.Singaravel, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response