It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level” in asp.net

Today i faced this problem while building my web application .

“It is an error to use a section registered as allowDefinition=’MachineToApplication’ beyond application level” in asp.net”

After trying with some ways and analyzing my folder directory i came to know that i have added one more web.config file to one of  its sub directory.

I removed the additional file and problem was resolved .

Ajax sample code for “Hello World” application

Hi ,
Today i am going to explain a simple “Hello World ” application  in asp.net , which will give you a basic idea about using ajax in your application .

Steps:
(1)Create a asp.net web site in VS200*
(2)On the Page1.aspx , add the following code

 

<script>

function createRequestObject() {
var ro;
var browser = navigator.appName;
if (browser == “Microsoft Internet Explorer”) {
ro = new ActiveXObject(“Microsoft.XMLHTTP”);
} else {
ro = new XMLHttpRequest();
}
return ro;
}

var http = createRequestObject();

function sndReq(action) {
http.open(‘GET’, ‘Page2.aspx);
http.onreadystatechange = handleResponse;
http.send(null);
}

function handleResponse() {
if (http.readyState == 4) {
var response = http.responseText;
// alert(response);
document.getElementById(‘MessBox’).value = response;
}
}

</script>

(3)Remove all the code from Page2.aspx and in Page2.aspx.cs, Page_Load add following code

protected void Page_Load(object sender, EventArgs e)
{
Response.Write(“I am coming from Page2 via Ajax call.”);
}

(4)Set page1 as startup page and click on button.
(5) Value dispalyed in text box is coming via ajax call.

Thanks