Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!