HTTP Error 404.3 – Not FoundThe page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

I was getting the above error while trying to run an ASP.NET page deployed inside IIS 8 in Windows 8 machine.

The fix was to enable the ASP.NET option of the IIS feature

Start -> Run -> appwiz.cpl -> Turn Windows features on or off -> Internet Information Services -> World Wide Web Services -> Application Development Features

Hope it helps.

The remote name could not be resolved while using HttpWebRequest

The issue could be because of proxy setting not specified for the web application. The solution to this is to add the following conifig info in the application’s web.config
<><defaultProxy  enabled=true” useDefaultCredentials=true>
<proxy  bypassonlocal=True”  proxyaddress=proxyaddress />

Hope it helps.

“DropDownList has a SelectedIndex which is invalid because it does not exist in the list of items” error while setting SelectedIndex

I had my drop down list defined as following
ID=”ddlNeedEFMP” runat=”server” Enabled=”False”>

To set it’s selectedindex we can make use of below syntax.

ddlNeedEFMP.SelectedIndex= ddlNeedEFMP.Items.IndexOf(ddlNeedEFMP.Items.FindByValue(“1”));

Hope it helps.

CS1026: ) expected error when using IFrame in Content Page

Hi I had the following iframe defined in one of my aspx page.

<iframe id=”MyIframe” src=”; runat=”server” onload=”CallHello();”></iframe> 

The page was working fine. However as soon as I specified the same iframe inside a master page, I started getting following error. 

Compiler Error Message: CS1026: ) expected 
Source Error: 

 Line 4: </asp:Content>
Line 5: <asp:Content ID=”Content2″ ContentPlaceHolderID=”ContentPlaceHolder1″ Runat=”Server”>

Line 6: <iframe ….src=….

Line 7: </asp:Content>

Line 8:


So here to resolve the error either remove the runat or onload attribute.



HyperLinkField and RowDataBound in ASP.NET

To access the HyperLinkField control with the RowDataBound event of the GridView, we can use the following code (refer the column cell)

protected void gridCaseMember_RowDataBound(object sender, GridViewRowEventArgs e){
if (e.Row.RowType == DataControlRowType.DataRow){
HyperLink myLink = (HyperLink)e.Row.Cells[0].Controls[0];

myLink.NavigateUrl =;;    }


Hope it helps !

Hiding Columns in GridView when AutoGenerateColumns is True


If we have set AutoGenerateColumns property of the GridView as true and binding it to a data source, we will not be able to remove columns from it using the Remove or RemoveAt functions of Columns.

myGridView.Columns.Remove or RemoveAt

So to remove the columns we can make use of RowDataBound event.

protected void myGridView _RowDataBound(object sender, GridViewRowEventArgs e){
// hide the second and third column
if (e.Row.RowType == DataControlRowType.DataRow)

if (e.Row.RowType == DataControlRowType.Header)
e.Row.Cells[1].Visible = false;

e.Row.Cells[2].Visible = false;}

Hope it helps!!

The current identity “domain\username” does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\Temporary ASP.NET Files’.

To reslove this error,

i first tried registering ASP.NET 2.0

1. Open a command prompt.
2. Navigate to ‘C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727\’
3. Run this: aspnet_regiis.exe -i

Followed by adding the “domain\username” to the “IIS_IUSRS” group.

This resolved the error.

Cannot read configuration file due to insufficient permissions


Was getting this issue in one of my ASP.NET application in IIS 7.

Gave Read Permission to IIS_IUSRS on the site.

This fixed the problem.

Good resources for understanding GridView

Check out these wonderful articles on GridView

And the best one,  a cook book on GridView


Body OnLoad function in content page in ASP.NET


I wanted to certain script to run in the onload of the body for my content page.

To do this we need to do the following

Add an id and runat attribute to the body tag in the MASTER page

<body id=”body” runat=”server”>

And in the Content page’s  page load handler

protected void Page_Load(object sender, EventArgs e)
HtmlGenericControl body = this.Master.FindControl(“body”) as HtmlGenericControl;
body.Attributes.Add(“onLoad”, “alert(‘Hello World’);”);


Server Application Unavailable in ASP.NET 2.0


I was getting this error when trying to open a 2.0 page.

However other applications developed in 1.1 were running fine.

Then realized that both of them were using the same Application Pool, so created a new application pool and assigned this new application pool to my 2.0 application.

That solved the issue.

“An application pool is a process that responds to web requests under IIS. An application pool does not have a setting for what type of ASP.Net applications will be run in it. Instead, it loads the appropriate libraries when an ASP.Net application is loaded in the process. Because the libraries for ASP.Net 1.1 and ASP.Net 2.0 are similar, but not the same, the application pool cannot respond to requests for both types of applications at the same time. This can cause sporadic behavior if you are using the server at the same time as another developer and you have applications using different versions of the framework in the same application pool”


Consuming CurrencyConverter web service through JavaScript


For getting the currency conversion rate we could use the following web service provided by Generic Objects Technologies Ltd.

Check out the web services provided by them

To consume their currency converter web service we could use the following JavaScript code

var xmlHttp;
function SoapCall() {
// creatng the xmlHttp object
xmlHttp = new ActiveXObject(“Microsoft.XMLHTTP”);
// Calling the web service using post and true means asynchronous call“post”, “;, false);
// Setting the request header to let the web service identify the soap request we would be sending

xmlHttp.setRequestHeader(“Content-Type”, “text/xml; charset=utf-8”);

xmlHttp.setRequestHeader(“SOAPAction”, “http://www.webserviceX.NET/ConversionRate&#8221;);

var soapRequest = “<?xml version=’1.0′ encoding=’utf-8′?> ” +
“<soap12:Envelope xmlns:xsi=’; xmlns:xsd=’; xmlns:soap12=’’>&#8221; +
” <soap12:Body>” +
”   <ConversionRate xmlns=’http://www.webserviceX.NET/’>&#8221; +
”     <FromCurrency>USD</FromCurrency>” +
”    <ToCurrency>INR</ToCurrency>” +
”  </ConversionRate>” +
“</soap12:Body>” +




Reading querystring using javascript

Hi while searching for the same,

got the following javascript

q =;

getParam = function(arg) {
if (q.indexOf(arg) >= 0) {
var pntr = q.indexOf(arg) + arg.length + 1;
if (q.indexOf(‘&amp;’, pntr) >= 0) {
return q.substring(pntr, q.indexOf(‘&amp;’, pntr));
} else {
return q.substring(pntr, q.length);
} else {
return null;

var objectId = getParam(‘oId’);


or better

function querySt(ji) {
hu =;
gy = hu.split(“&”);
for (i=0;i<gy.length;i++) {
ft = gy[i].split(“=”);
if (ft[0] == ji) {
return ft[1];

var pId= querySt(“pId”);

Here oId is the query string parameter whose value we need.

This works even if there are multiple query string parameters !


Error : The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.


I got this error while developing an page with Sql server as database,

On checking the sql query i found out that the date value was not being sent in the format expected by the database , so by changing the format within my query resolved the issue !

Initially it was calendar.ToShortDateString() and i changed it to 



Error : This application is already precompiled in ASP.NET


I was getting this error while trying to build one of the web site in Visual studio, on some searching found out the error was because of an existing PrecompiledApp.config within the application folder!

On deleting that file and rebuilding the web site, everything was back on track !


Gridview SelectedIndexChanged Showing no Data

It could happen if we are dynamically creating DataTable and bounding it to our GridView. Searching for it if found the following information on one of the blog


The GridView (and actually, all our data controls) does not save data items across postbacks.  This reduces ViewState (if the objects are even serializable) and enables garbage collection to happen and clean up your objects.  So, when you click the button to post back, the GridView has not called DataBind and therefore your data item isn’t there.  This is what you’ve discovered.

Selection is handled slightly differently than choosing an edit item, sorting, paging, or other functions: because those other functions require a change in the control tree or a query to the data source to get different data, they cause a DataBind to happen automatically at some point before the control renders again.  You can handle RowDataBound and get your data item.  Selection, however, doesn’t require new data or a different control tree (all that usually changes is the style properties on the row), so it will never call DataBind.  This makes selection very fast.  It also means you won’t get a DataBound or RowDataBound event unless you call DataBind yourself.  So you can’t use that event to get your data item unless you call it yourself.  If you need the data item, you can call DataBind yourself directly to get it, then handle OnRowDataBound, check the row index against the SelectedIndex, and get the data item.

However, this is kind of the shotgun method- it will get you what you want, but the performance has decreased because you’ve called DataBind again.  Also, if the data in the data store has been modified between your calls to databind, the row index that was the selected item may now point to a different row or just different data.  What data are you really looking for from the selected data item?  Is it just one or two fields?  If so, consider using DataKeyNames to store these fields, and then you can get to them via the DataKeys property.  If you don’t want to suffer the hit to ViewState from DataKeyNames, consider getting the data directly from the controls in the row of the GridView.

So I followed the suggestion highlighted in yellow and was able to retrieve the value for the selected row.


  protected void grdPropertyValues_SelectedIndexChanged(object sender, EventArgs e)


        GridViewRow row = grdPropertyValues.SelectedRow;

        // Get the selected row index

        iRownum = grdPropertyValues.SelectedIndex;

        // call the method that dynamically creates the DataTable and

        // bind the gridview to it

        BindConferenceDayToGrid(myList, grdPropertyValues);




protected void grdPropertyValues_RowDataBound1(object sender, GridViewRowEventArgs e)


        // getting the GridViewRow

        GridViewRow row = e.Row;

        // if RowType is DataRow and RowIndex is our selected row’s index

        if (e.Row.RowType == DataControlRowType.DataRow && row.RowIndex == iRownum)


                DataRowView drv = (DataRowView)e.Row.DataItem;

                Response.Write(“The value we need “+drv.Row[1].ToString());          




That’s it ..




Publishing workflow as an ASP.NET Web Service.


The workflows developed using windows workflow foundation can be published as a web service. To publish a workflow as a web service, we are provided with two activities. WebServiceInput and WebServiceOutput activity.


To create a workflow to be published as a web service do the following


Create a new Empty Workflow Project.


Add a new interface class to the project which would be used by our WebServiceInput activity.


Suppose this is our interface class.


interface IAddInterface


        int AddNumber(int firstNumber, int secondNumber);



Now right click on the project and add a new Sequential Workflow.


Now drag and drop three activities. First WebServiceInput, Code and WebServiceOutput.


For webServiceInputActivity1 specify following properties.


InterfaceType –IAddInterface.

MethodName AddNumber


As soon as method is added we’ll see two new properties added over there one for each parameter specified in the interface method.

i.e. firstNumber and secondNumber.


Create two variables to bind with them and one more variable to hold the result.


  public int intFirstNumber;

  public int intSecondNumber;

  public int total;



Specify intFirstNumber, intSecondNumber for firstNumber and secondNumber property of webServiceInputActivity1.


Finally set IsActivating as true;



Now right click code activity and select generate handlers to create a handler method and specify the following code for it


private void codeActivity1_ExecuteCode(object sender, EventArgs e)


            total = intFirstNumber + intSecondNumber;



Now select webServiceOutputActivity1 and set its properties as following


InputActivityName = webServiceInputActivity1


ReturnValue = Activity=AddWebServiceWorkflow, Path=total (i.e. to total variable)


That’s it now we want to publish it as workflow.


For this right click the project and Select Publish as a web servcie option.



This would create a new webservice which would be named as worklflowProjectName.worfklowMethodName_WebService.asmx.


Now we could use it just like any other web service created using ASP.NET.


WebServiceInputActivity recieves input from the client using the webservice. It can be  associated with single web service method defined inside the interface. The WebServiceInputActivity can be followed by the set of activities which could be built in or custom activity. If the response has to sent back to the calling client than we need to make use of WebServiceOutputActivity.

Understanding and Using AJAX

Suppose this is our simple ASP.NET page i.e. MyPage.aspx which would be called using AJAX

Code for MyPage.aspx.cs

protected void Page_Load(object sender, EventArgs e)


// no data is passed

if (Request.QueryString[“myGetData”] == null)


Response.Write(“Hello World”);


// if GET method is used to call this page

else if (Request.QueryString[“myGetData”] != null)


Response.Write(“Hello “ + Request.QueryString[“name”].ToString());


// if POST method is used to call this page

else if (Request.Form[“myPostData”] != null)


Response.Write(“My Post Data is “ + Request.Form[“myPostData”].ToString());



Delete everything from MyPage.aspx page just keep the page directive otherwise html tags would also be sent as a part of response.

<%@ Page Language=”C#” AutoEventWireup=”true” CodeFile=”Mypage.aspx.cs” Inherits=”MyPage” %>

Now the javascript code to call the page asynchronously using AJAX. Comment/Uncomment the particular section of code to test the functionality

<script type=”text/javascript”>

var request=null;

function CreateRequest()




// create a new object to talk HTTP with a web server.

// XMLHttpRequest – works on Safari,Firefox, Mozilla, Opera , IE 7 and most other browsers

request=new XMLHttpRequest();






// Msxml2.XMLHTTP – Most version of IE support this

request=new ActiveXObject(“Msxml2.XMLHTTP”);






//Microsoft.XMLHTTP – but for some, we’ll need this other type

request=new ActiveXObject(“Microsoft.XMLHTTP”);









alert(‘Error creating request object’);



// i.e. space with %20

// if no data is to be send

var url=“MyPage.aspx”;

// open-initialize the connection

// GET – specify how to send data to the server

// url- url to send the request

// asynchrounous – true“GET”,url,true);

// telling the browser what to do with the server’s response

// i.e. the function to be called when response is received

// onreadystatechange- this property affects every ready state not just the one indicating

// that the server is finished with request


// send the request

// no data is required so send null

// for using send() to pass data to a server requires POST method for the request and need to specify content type


// if data is to be send using GET i.e. as query string

var name=“MyName”;

// escape() function replaces characters like space with something that will work as a part of a request URL.

var url=“MyPage.aspx?myGetData=”+escape(name);“GET”,url,true);



// if more data is to be send than use post

var name=“MyName”;

var url=“MyPage.aspx”;“POST”,url,true);


//setRequestHeader()- allows us to add information to the request usual intended for use by the server

// Content-Type – is the name of the request header

// application/x-www-form-urlencoded – the value of the request header

// this tells the server that the data is encoded like it would be in a request URL

// for passing XML content replace “application/x-www-form-urlencoded” with “text\xml”


// specify the data to be send

// escape() function replaces characters like space with something that will work as a part of a request URL.




// updatepage – this function will get run every time the ready state changes

function updatepage()


// readyState=this property of the request object stores the current state

// if 4 means server is done with the request

// if 0 i.e uninitialized

// if 1 i.e open, the object has been created but the send method has not been called

// if 2 i.e. sent, the send method has been called.

// if 3 i.e. receiving , responseText is not available but some data has been received

// if 4 i.e. loaded, all the data has been received, responseText is available



// check for the status send by the server

// if 200 i.e. everything is fine

// if 404 i.e. if the page specified in the url is not found



var myResponse=request.responseText;





alert(“Error! Request status is “ +request.status);





<input id=”Button1″ type=”button” value=”button” onclick=”CreateRequest()”/>


Calling an ASP.NET web service asynchronously.

When we add a web reference to a web service behind the screen wsdl.exe is run which creates the proxy class. Proxy class contains both synchronous and asynchronous flavors of each web method.For simple HelloWorld() web method following methods are there in the proxy class

Public string HelloWorld()

Public string HelloWorldAsync();

Public string HelloWorldAsync(object userState);

We call the HelloWorldAsync() method which in turn calls the following method of the proxy class InvokeAsync()

// Summary:

// Invokes the specified method asynchronously.

// Parameters:

// methodName:

// The name of the method to invoke.

// parameters:

// The parameters to pass to the method.

// callback:

// The delegate called when the method invocation has completed.

protected void InvokeAsync(string methodName, object[] parameters, SendOrPostCallback callback);

HelloWorldCompletedEventArgsThis class is also created by wsdl.exe which contains the result of our operation.

Suppose this is our simple web service, we have introduced delay to understand the asynchronous behavior.


public string HelloWorld() {


return “Hello World”;


Now to call the above webservice method asynchrously in a windows application client we need to do the following

Say we have want to call the HelloWorld method asynchronously on the click of the button,

private void btnCallService_Click(object sender, EventArgs e)


// Create the instance of the proxy class

Service myService = new Service();

// Register an eventhandler for HelloWorldCompleted event

// The eventhandler would be called when the request is

// completed

myService.HelloWorldCompleted += new


// instead of calling the synchronous HelloWorld() we need

// to call the HelloWorldAsync() method



void HelloWorldCompleted(object sender,HelloWorldCompletedEventArgs args){

// Display the reutrn value



To call the above web method in an client we need to add the following attribute in the @Page directive



FileUpload : Page Cannot be displayed and maximum request length exceeded error

By default, ASP.NET permits only files that are 4,096 kilobytes (KB) or less to be uploaded to the Web server.  To upload larger files, we must change the maxRequestLength parameter of the <httpRuntime> section in the Web.config file. By default, the <httpRuntime> element is set to the following parameters in the Machine.config file:









We can change the value of maxRequestLength to a desired value in our web.config of the application. For 10 mb we can set it to 10240 KB. Even in this case if user tries to upload a file with size more than 10 mb we than get the above “Page cannot be displayed error ” or the page simply hang up. In this case we can catch the error in the Application_Error event handler of the Global.asax file.

void Application_Error(object sender, EventArgs e)


if (System.IO.Path.GetFileName(Request.Path) == “Default.aspx”)


System.Exception appException = Server.GetLastError();

if (appException.InnerException.Message == “Maximum request length exceeded.”)



Response.Write(“The form submission cannot be processed because it exceeded the maximum length allowed by the Web administrator. Please resubmit the form with less data.”);

Response.Write(“<BR><a href=’Default.aspx’>Click Here to go back to page</a> </BR>”);

Response.End();  } } }

I tried with the above code, but it isn’t consistent.

The best solution for this could be to set the value of maxRequestLength to a very high value.

and checking in the code for the size.

Say changing the value to say 700mb ( not sure what the maximum length of request could be)

<httpRuntime useFullyQualifiedRedirectUrl=true



And checking for the length in your code

// Putting the constraint of 1 mb

if (FileUpload1.FileContent.Length < 1024){

FileUpload1.SaveAs(@”C:/MyFolder/” + FileUpload1.FileName);}



At least the above solution would save us from the page not displayed error.

And the last solution which i found was creating an httpmodule to intercept the web request.

using System;

using System.Collections.Generic;

using System.Text;

using System.Web;

namespace HAMModule{

public class MyModule : IHttpModule{

public void Init(HttpApplication app){

app.BeginRequest += new EventHandler(app_BeginRequest);


void app_BeginRequest(object sender, EventArgs e){

HttpContext context = ((HttpApplication)sender).Context;

// check for size if more than 4 mb

if (context.Request.ContentLength > 4096000){

IServiceProvider provider = (IServiceProvider)context;

HttpWorkerRequest wr = (HttpWorkerRequest)provider.GetService(typeof(HttpWorkerRequest));

// Check if body contains data

if (wr.HasEntityBody()){

// get the total body length

int requestLength = wr.GetTotalEntityBodyLength();

// Get the initial bytes loaded

int initialBytes = wr.GetPreloadedEntityBody().Length;

if (!wr.IsEntireEntityBodyIsPreloaded()){

byte[] buffer = new byte[512000];

// Set the received bytes to initial bytes before start reading

int receivedBytes = initialBytes;

while (requestLength – receivedBytes >= initialBytes){

// Read another set of bytes

initialBytes = wr.ReadEntityBody(buffer, buffer.Length);

// Update the received bytes

receivedBytes += initialBytes;


initialBytes = wr.ReadEntityBody(buffer, requestLength – receivedBytes);}}

// Redirect the user to an error page.


public void Dispose(){}


and add the following information to web.config


<add type=HAMModule.MyModule name=MyModule/>




The last solution worked properly!!!!

BeginRequest event –The BeginRequest event signals the creation of any given new request. This event is always raised and is always the first event to occur during the processing of a request.

Article on creating a custom http module


Using Encryption and Decryption in an ASP page

Hi I was looking for implementing cryptography in an ASP page.

I found this following article of great use

The inc file

Dim sbox(255)
Dim key(255)

Sub RC4Initialize(strPwd)
dim tempSwap
dim a
dim b
intLength = len(strPwd)
For a = 0 To 255
key(a) = asc(mid(strpwd, (a mod intLength)+1, 1))
sbox(a) = a

b = 0
For a = 0 To 255

b = (b + sbox(a) + key(a)) Mod 256
tempSwap = sbox(a)
sbox(a) = sbox(b)
sbox(b) = tempSwap
End Sub

Function EnDeCrypt(plaintxt, psw)

dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher

i = 0
j = 0

RC4Initialize psw
For a = 1 To Len(plaintxt)
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp
k = sbox((sbox(i) + sbox(j)) Mod 256)

cipherby = Asc(Mid(plaintxt, a, 1)) Xor k
cipher = cipher & Chr(cipherby)
EnDeCrypt = cipher
End Function


And following is the code for my asp page

<!–#include file=””–>

<form action=”G.asp” method=”post”>
dim psw, txt
dim strTemp
response.write “Encrypted Text =” & strTemp & “</Br>”
response.write “Decrypted Text =” & txt



Just copy and paste the code

That’s it …

IIS not serving ASP.NET pages

It mostly happens when IIS is installed after .NET is installed. So in this case we need to make use of aspnet_regiis.exe utility.
1) Go to command prompt
2) Go to the following path
depending on the version.
3) Enter “aspnet_regiis.exe -i”
4) It will display the message finished installing
5) Open your IIS
6) Select web service extensions
7) Click on Allow for ASP.NET v2.0.50727

That’s it . Now the IIS has been configured properly

Using Web Service as a Data Source in Sql Server Reporting Services

Suppose this is a simple web method inside a web service in ASP.NET.


public string HelloWorld(String FirstName, String LastName) {

return “Hello “ + FirstName+ ” “ + LastName ;


Now we would to add the above as a xml data source in out Report.

For this we need to do the following

  • Create a new Report
  • Select <New DataSet..>
  • For Type (inside General Tab) select XML as DataSource type.
  • Inside connection string give the path to the web service.
  • i.e. http://localhost:2584/WebSites/Service.asmx
  • Define query for the data source in the following manner


<Method Namespace= Name=HelloWorld>





We can create report parameters for FirstName and LastName parameters of the method.

Or we want to define default values for these parameters define the query as following



<Method Namespace= Name=HelloWorld>


<Parameter Name=FirstName>



<Parameter Name=LastName>









Customizing Default IE Test Page for ASP.NET web service


When we create ASP.NET web service from visual studio and run the web service a test page opens up in which we can test our web service.

We can easily customize that web service test page. The name of the page is DefaultWsdlHelpGenerator.aspx we can found it in the following directory

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\ for ASP.NET 2.0.

Open the page in Visual Studio

First and foremost we would find the following things that could be configured

// set this to true if you want to see a POST test form instead of a GET test form
bool showPost = true;

// set this to true if you want to see the raw XML as outputted from the XmlWriter (useful for debugging)
bool dontFilterXml = false;

// set this higher or lower to adjust the depth into your object graph of the sample messages
int maxObjectGraphDepth = 4;

// set this higher or lower to adjust the number of array items in sample messages
int maxArraySize = 2;

// set this to true to see debug output in sample messages
bool debug = false;

To customize the UI good information is provided over here

Customizing Web Service Test Page’s UI Design

By Default the web service can be tested using Http Get (default) and Http Post, but if we want to test using the SOAP we can make use of the information provided in the following link

Testing Web Service with SOAP


Consuming an Asp.NET web service using SOAP protocol from JavaScript

There are many ways we can consume a web service
The three common protocols for accessing a .NET web service are
The trasport protocol used for them is HTTP. However a web sercie can work on any other internet protocol like SMTP, FTP, Jabber, and TCP.

For HTTP GET and HTTP POST method you can refer to these posts
The proxy class generated by Visual studio for us using the wsdl itself uses the SOAP.
Let’s take an example of calling the simple web service using SOAP through java script.
Say this is our sample web service

[WebService(Namespace = “http://myNamespace/&#8221;)]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
public class Service : System.Web.Services.WebService
public Service () {
//Uncomment the following line if using designed components
public string HelloWorld(String name) {
return “Hello “+name;


The javascript code that we can use to call this web service using SOAP request would be this
<script type=”text/javascript”>
var xmlHttp;
function SoapCall()
// creatng the xmlHttp object
xmlHttp=new ActiveXObject(“Microsoft.XMLHTTP”);
// Calling the web service using post and true means asynchronous call“post”, “http://localhost/WebSite/WebSite4/Service.asmx&#8221;, true);
// Setting the request header to let the web service identify the soap request we would be sending
xmlHttp.setRequestHeader(“Content-Type”,”text/xml; charset=utf-8″);
// http://myNamespace/HelloWorld – name of the webmethod
//[WebService(Namespace = “http://myNamespace/&#8221;)] which we had applied to our web service class
// setting the soap request body
var soapRequest=”<?xml version=’1.0′ encoding=’utf-8′?>” +
“<soap:Envelope xmlns:xsi=’'”+
” xmlns:xsd=’; xmlns:soap=’’>”+
“<HelloWorld xmlns=’http://myNamespace/’>”+
“<name>Nishant Rana</name> “+
” </soap:Body>”+

return false;


function doUpdate()
var responseXMLResult=xmlHttp.responseXML;
var result = responseXMLResult.lastChild.nodeTypedValue;

We will receive the following Soap Response
<?xml version=”1.0″ encoding=”utf-8″?>
<soap:Envelope xmlns:soap=”; xmlns:xsi=”; xmlns:xsd=””&gt;
<HelloWorldResponse xmlns=”http://myNamespace/”&gt;
<HelloWorldResult>Hello Nishant Rana</HelloWorldResult>

We can create our SOAP request by making use of the test page of our Web Service which we can open in IE.

Or else we can use Fiddler tool. (


Unable to generate a temporary class (result=1). error CS2001: Source file ‘C:\WINDOWS\TEMP\filename.cs’ could not be found error CS2008: No inputs specified


I was getting this error when I was trying to call a .NET dll from an ASP page.

The dll was making use of a web service.

And while searching for it I found that if we are making use of a web service from

an asp page, the page tries to create a temporary file in windows\temp directory and because it hasn’t got rights for the same we get the error.


We can resolve it by giving it the appropriate rights for the windows/temp folder


1) Right click the temp folder à Select properties

2) Go to security tab

3) Click on Add and add ASPNET account. ( In locations select your machine )

4) Then add one more account IWAM_D-0824 (i.e. IWAM_YourMachineName)

5) Try running the ASP page again. The page should run without any error.