308 Permanent redirect

HI there
I have a problem related to 308 Permanent redirect - status code in my app. I want to upload a file to CrossEngage platform and everything is alright when using a POSTMAN but when I do the same using HttpWebRequest or RestClient on my application I’m getting 308 Permanent redirect - What I’m not doing that POSTMAN is doing ?

My code:
byte dataBytes = System.IO.File.ReadAllBytes(path);
string converted = Convert.ToBase64String(dataBytes);

        var client = new RestClient(Url+Action);
        client.FollowRedirects = true;
        var request = new RestRequest(Method.GET);            
        request.AddHeader("cache-control", "no-cache");
        request.AddHeader("x-xng-authtoken", AuthToken);
        request.AddHeader("x-xng-apiversion", "2");
        request.AddHeader("content-type", "application/pdf");
        request.AddParameter("application/pdf", converted, ParameterType.RequestBody);            
        IRestResponse response = client.Execute(request);

Thanks in advance

I’d first check your Postman’s settings, you might have Automatically Follow Redirects to off

See if that’s set to off and then set it to on and see if it starts to behave the same in your application.

Hi Kyle

Thanks for answering me. I have solved my problem already by following redirection from the response.

Thanks again




1 Like