Using Restsharp in asp.net to connect to Jira REST API

1,152 views
Skip to first unread message

upadhya...@gmail.com

unread,
Sep 13, 2013, 10:36:56 AM9/13/13
to rest...@googlegroups.com
Hello,

I am using asp.net and restsharp v103.4 to get the jira issues using jira rest api

My authentication code works perfectly in Form based desktop application, but the same code dosenot work in asp.net webpage.

            RestClient client = new RestClient("https://dhavalupadhyaya.atlassian.net")
            {
                Authenticator = new HttpBasicAuthenticator("**username**", "**password**")
            };

            var request = new RestRequest();
            request.Resource = "rest/auth/1/session";
            request.AddParameter(new RestSharp.Parameter()
            {
                Name = "username",
                Value = "**username**",
                Type = ParameterType.GetOrPost
            });
            request.AddParameter(new RestSharp.Parameter()
            {
                Name = "password",
                Value = "**password**",
                Type = ParameterType.GetOrPost
            });
            request.Method = Method.POST;

            var response = client.Execute(request);


The above code gives Unable to connect to the remote server error.

Alexander Harris

unread,
Nov 21, 2014, 5:49:51 AM11/21/14
to rest...@googlegroups.com
Any update on this? 

I have a very similar problem where I've written a small library of my own which uses RestSharp to connect to the facebook API.

This works perfectly from my Console App test harness, but when using it in a MVC app I get "Unable to connect to the remote server".

I took a breakpoint at the point the call to my lib was made, copied out all the parameters passed to it and then manually made the identical call with these parameters from my test harness, and the request succeeded.

Any ideas?

I've seen people talk about deadlocking in ASP apps when using await and async because of the way Syncronisation contexts work, compared to console apps. However, all my calls are synchronous...
Reply all
Reply to author
Forward
0 new messages