0

This has just gotta be dead simple. I have a web page that processes files on the server. I'm trying to call it and simply send the filename on the URL to kick it off but it's only calling the notificatin URL and not calling my parameters. What am I doing wrong?

    private void Notify(IDictionary config, String fn)
    {

        //check to see if a notification url was specified
        if (string.IsNullOrEmpty((String)config["notificationUrl"]))
        {
            log.Warn("No 'notificationUrl' specified. No notification generated.");
        }
        else
        {

            WebRequest wr = WebRequest.Create(string.Format(config["notificationUrl"].ToString() + "?file=" + fn));
            wr.Method="GET";

            HttpWebResponse hwr = (HttpWebResponse)wr.GetResponse();
            if (hwr.StatusCode != HttpStatusCode.OK)
                throw new Exception("Upload File created, but HTTP notification url returned status code: " + hwr.StatusCode.ToString());
        }
    }
Codex
  • 131
  • 6
  • 1
    What do you mean by "calling" your parameters? What diagnostics have you performed to check the final URL in code and what the request looks like on the network? – Jon Skeet Jun 26 '13 at 13:49
  • I mean I have a url, http://testit.com?file=test.xml It hits the page testit.com but the file parameter isn't there. The URI is complete but is only hitting the server without the parameters added. – Codex Jun 26 '13 at 14:11
  • That seems unlikely to me - but it's also odd that you're using `string.Format` at all... why are you doing so? I would separate the URL generation from the WebRequest creation, making it easier to debug. You should then *definitely* look at what's happening on the network using Wireshark. – Jon Skeet Jun 26 '13 at 14:12
  • Ah, thanks man. Working on someone else's code here. I did that and found some funky things going on in the target file rather than the URI being the issue. Resolved now. Cheers and thanks. – Codex Jun 26 '13 at 14:50

0 Answers0