call a c# function in javascript
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/12421716/call-c-sharp-function-in-javascript">Call c# function in javascript</a>  </p>
</blockquote>



<p>I have a c# function containing an if statement (if (condition) test=true else test= false )), Can anyone tell me how to call that function in javascript and use the result of that test variable to do an if statement.</p>

<p>The c# file I am referencing is the code behind (.aspx.cs) to an .aspx page. Is there not a way I can call the following function from this .aspx page.</p>

<pre><code>public void write(bool complete)     
{          
System.IO.StreamWriter writer = new System.IO.StreamWriter(Server.MapPath("~file.txt"), true);          
if (complete == true)         
{             
writer.WriteLine("completed");         
}         
else         
{             
writer.WriteLine("FAILED");         
}         
writer.Flush();         
writer.Close();         
writer.Dispose();     
} 
</code></pre>
