0

I am making a GET call but it's changing url of request, because of which I am getting wrong url in code behind using HTTP CONTEXT (in real using SPContext...), Looking at network tag I got this,

Request URL : https://myPortal.govment.com/us/216/files/_vti_bin/project/project.svc/Users/ExistsByLuck?username=asdasdadasd

Location : https://myPortal.govment.com/_vti_bin/project/project.svc/Users/ExistsByLuck?username=asdasdadasd

it's removing this "us/216/files/" from my url and status code is 307 Temporary Redirect

How can I avoid this behavior ?

This is how I am making this request,

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_vti_bin/project/project.svc/Users/ExistsByLuck",
    type: "GET",
    data: { username: parameterUsername },
    contentType: "application/json; charset=utf-8"
})
Mathematics
  • 7,314
  • 25
  • 77
  • 152

1 Answers1

0

I fixed this by adding "/" to my calling url,

so now it looks like this,

$.ajax({
    url: _spPageContextInfo.webAbsoluteUrl + "/_vti_bin/project/project.svc/Users/ExistsByLuck/",
    type: "GET",
    data: { username: parameterUsername },
    contentType: "application/json; charset=utf-8"
})

This helped me

Community
  • 1
  • 1
Mathematics
  • 7,314
  • 25
  • 77
  • 152