Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8509529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T03:27:32+00:00 2026-06-11T03:27:32+00:00

The first two functions works well but the third one with some error unclear.

  • 0

The first two functions works well but the third one with some error unclear. Here is all the codes and could you help me how to complete the last function.

code in WebService1.asmx

using System.ComponentModel;
    using System.Web.Services;
    using System.Text;
    using System.IO;

namespace WebApplication1
{
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    [System.Web.Script.Services.ScriptService]
    public class WebService1 : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorldFun1()
        {
            return "Hello World";
        }
        [WebMethod]
        public string HelloWorldFun2(string str)
        {
            return "Hello World,"+str;
        }
        [WebMethod]
        public string Write_to_File(string str)
        {
            StreamWriter _testData = new StreamWriter(Server.MapPath("~/output.txt"), true);
            _testData.WriteLine(str); // Write the file.
            _testData.Flush();
            _testData.Close(); // Close the instance of StreamWriter.
            _testData.Dispose(); // Dispose from memory. 
            return str;
        }

    }
}

code in Default.aspx

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>WebService</title>
    <script type="text/javascript" language="javascript">
        function func1()
        {        
        WebApplication1.WebService1.HelloWorldFun1(onSuccess,onFail,'Span1');
        }
        function func2()
        {
        var txt=document.getElementById('Text1').value;
        WebApplication1.WebService1.HelloWorldFun2(txt,onSuccess,onFail,'Span2');
        }
        function write()
        {
        var txt = document.getElementById("Span1").innerHTML;
        WebApplication1.WebService1.Write_to_File("kkkkkkkkkk",onSuccess,onFail,'Span3');
        }
        function onSuccess(value,context)
        {
        document.getElementById(context).innerHTML=value;
        }
        function onFail(value)
        {
        alert(value);
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
    <Services>
        <asp:ServiceReference Path="~/WebService1.asmx"  />
    </Services>
    </asp:ScriptManager>
    <input id="Button1" type="button" value="button"  onclick="func1()" />&nbsp;&nbsp;&nbsp;&nbsp;<span id="Span1"></span>
    <hr />
    <input id="Text1" type="text" /><input id="Button2" type="button" value="button"  onclick="func2()" /><span id="Span2"></span>
    </form> 
    <input id = "WTF" type = "button" value = "write" onclick ="write()"/><span id="Span3"></span>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T03:27:34+00:00Added an answer on June 11, 2026 at 3:27 am

    I have know the reason. There should be some defined function named “write()”. I just change the name “write()” to “write_to()” and then it works well. Thanks for your answers, Vitali Kaspler.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two functions. The first is the one in which all the input
Assuming I have the following two JQuery functions - The first, which works: $(#myLink_931).click(function
I have two jQuery functions. The first one below I want to run first,
Below program contains two show() functions in parent and child classes, but first show()
I made two different Fibonacci functions, the first one worked perfectly. Then I tried
Here, I have two different version of my code. The first one is a
Let's say that there are two PHP functions. function first() { $keyword = $this->input->post('keyword');
Here is two variants. First: int n = 42; int* some_function(int* input) { int*
freeze the first two column but if I want to freeze the column dynamically
I have some code where I need two separate required field validators for one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.