Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

100
Visualizações
asp.net core and httprequest attributes from xmlhttprequest

I have been tasked with translating a java app into asp.net 5 and i am still somewhat new to it (asp.net 5). The following java and javascript (excerpts from the project) work:

javascript:

var connect_xmlhttprequest = new XMLHttpRequest();
connect_xmlhttprequest.open("POST", "tunnel?connect", true);
        connect_xmlhttprequest.withCredentials = withCredentials;
        addExtraHeaders(connect_xmlhttprequest, extraHeaders);
        connect_xmlhttprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded; charset=UTF-8");
        connect_xmlhttprequest.send(data);
//data ='&WIDTH=1692&HEIGHT=902&DPI=120'

java:

 protected void handleRequest(HttpServletRequest request,
            HttpServletResponse response) throws ServletException {
        String query = request.getQueryString();
        int h = Integer.valueOf(request.getParameter("HEIGHT"));
        int w = Integer.valueOf(request.getParameter("WIDTH"));
}

In the above code, query becomes "connect" and intenger values of the resolutions passed in the xmlhttprequest are pulled and assigned.

In asp.net 5 i'm having trouble. I can get the querystring:

string query = context.Request.QueryString.Value; //gives me "?connect"
string sHeight= request.Query["HEIGHT"].ToString(); //null
string sWidth= request.Query["WIDTH"].ToString(); //null

The above is NOT working. My understanding was that since the encoding of the xmlhttprequest was application/x-www-form-urlencoded then it would put the data passed in the .send() into the url. I've been going through the HttpRequest object but so far have found nowhere that the data sent is located. Any help to understand what's going on here would be greatly appreciated. All thutorials and example I've found with xmlhttprequest and asp.net at all deal with json and righ now I'm trying to convert the java to c# and leave the javascript alone if possible.

My understanding is that asp.net has System.Web which core doesn't have has similar systems such as the params method, but I take it that's not usable in a core app?
Thanks again!

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda