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

  • Home
  • SEARCH
  • 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 6089377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:05:36+00:00 2026-05-23T12:05:36+00:00

I have a strange issue using HttpWebRequest, I’m trying to post a string to

  • 0

I have a strange issue using HttpWebRequest, I’m trying to post a string to a service but HttpWebResponse keeps producing the following error;

"System.Net.WebException: The remote server returned an error: NotFound. ---> System.Net.WebException: The remote server returned an error: NotFound.   at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)\r\n   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClass2.<EndGetResponse>b__1(Object sendState)\r\n   at System.Net.Browser.AsyncHelper.<>c__DisplayClass4.<BeginOnUI>b__1(Object sendState)\r\n   at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)\r\n   at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)\r\n   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n   at System.Delegate.DynamicInvokeOne(Object[] args)\r\n   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)\r\n   at System.Delegate.DynamicInvoke(Object[] args)\r\n   at System.Windows.Threading.Dispatcher.<>c__DisplayClass4.<FastInvoke>b__3()\r\n   at System.Reflection.RuntimeMethodInfo.InternalInvoke(RuntimeMethodInfo rtmi, Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture, Boolean isBinderDefault, Assembly caller, Boolean verifyAccess, StackCrawlMark& stackMark)\r\n   at System.Reflection.RuntimeMethodInfo.InternalInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, StackCrawlMark& stackMark)\r\n   at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)\r\n   at System.Delegate.DynamicInvokeOne(Object[] args)\r\n   at System.MulticastDelegate.DynamicInvokeImpl(Object[] args)\r\n   at System.Delegate.DynamicInvoke(Object[] args)\r\n   at System.Windows.Threading.DispatcherOperation.Invoke()\r\n   at System.Windows.Threading.Dispatcher.Dispatch(DispatcherPriority priority)\r\n   at System.Windows.Threading.Dispatcher.OnInvoke(Object context)\r\n   at System.Windows.Hosting.CallbackCookie.Invoke(Object[] args)\r\n   at System.Windows.Hosting.DelegateWrapper.InternalInvoke(Object[] args)\r\n   at System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(IntPtr pHandle, Int32 nParamCount, ScriptParam[] pParams, ScriptParam& pResult)\r\n\r\n   at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)\r\n   at System.Net.Browser.ClientHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)\r\n   at ZabbixClient.MainPage.ResponseCallBack(IAsyncResult result)\r\n   at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2)\r\n   at System.Threading.ThreadPool.WorkItem.doWork(Object o)\r\n   at System.Threading.Timer.ring()\r\n"

My code looks like;

 private void btnSignin_Click(object sender, RoutedEventArgs e)
    {
        // Prepare web request...
        HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(new Uri("http://monitor.co.uk", UriKind.Absolute));
        myRequest.Method = "POST";
        myRequest.ContentType = "application/x-www-form-urlencoded";
        myRequest.BeginGetRequestStream(new AsyncCallback(RequestCallBack), myRequest);
    }

void RequestCallBack(IAsyncResult result) {
        HttpWebRequest myRequest = result.AsyncState as HttpWebRequest;

        //need error checking for this part
        Stream stream = myRequest.EndGetRequestStream(result);

    using (StreamWriter sw = new StreamWriter(stream)){

        sw.Write("{ \"jsonrpc\":\"2.0\",\"method\":\"user.authenticate\",\"params\":{\"user\":\"<login>\",\"password\":\"<password>\"},\"id\":2}");
    }
    myRequest.BeginGetResponse(ResponseCallBack, myRequest);
    }

void ResponseCallBack(IAsyncResult result)
    {
        //get to the request object
        HttpWebRequest myRequest = result.AsyncState as HttpWebRequest;
        try
        {
            //need error checking here
            HttpWebResponse response = myRequest.EndGetResponse(result)
                as HttpWebResponse;
            using (StreamReader sr = new StreamReader(response.GetResponseStream()))
            {
                System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show(sr.ReadToEnd()); });
            }
        }
        catch (WebException webExcp)
        {
            System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show(webExcp.ToString()); });
        }
    }

I just can’t figure out what’s going on, the URL is specified correctly and working, I read to use fiddle to monitor what was going on but nothing appears in fiddler suggesting it’s not even getting to make a request? Any info would be appreciated. Thanks!

  • 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-05-23T12:05:36+00:00Added an answer on May 23, 2026 at 12:05 pm

    First, let me point out a problem in your code:

    using (StreamReader sr = new StreamReader(response.GetResponseStream()))
    {
       System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show(sr.ReadToEnd()); });
    }
    

    The stream will be closed by the time you will attempt to display the result. What you should do is have something like this:

    using (StreamReader sr = new StreamReader(response.GetResponseStream()))
    {
        String s = sr.ReadToEnd();
        System.Windows.Deployment.Current.Dispatcher.BeginInvoke(() => { MessageBox.Show(s); });
    }
    

    Yet, I am not sure why you want to display the response in a MessageBox instance – it will be basically unreadable – use the Output console for debugging purposes.

    Back on topic – NotFound is usually returned by the server and has nothing to do with the request being processed by the OS. It is a very generic error and you need to make sure that what you are invoking is supported on the other end.

    Make sure that you have a good Internet connection (on a side note).

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

Sidebar

Related Questions

I have a strange issue: I am using SPContext.Current.Web in a .aspx page, but
I have a strange little issue with a WCF RIA service I'm using in
I have this strange issue with my web app. You see, I'm using jQuery
I am trying to debug a strange issue with users that have LogMeIn installed.
I have a strange issue. I'm trying to write a simple php webpage on
I have a strange issue with an Asp.NET MVC application. Using Asp.NET MVC 3
I have a strange issue. I'm trying to get Apple Push Notifications working with
I have a really strange issue when using hibernate to connect to a MySQLDB
We have a strange issue with running an Facebook IFrame application (using MVC 2).
I have some strange issue using jQuery Validation plugin. Firs of all here is

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.