[BUG]Sys.Net.WebRequest.createUrl doesn't work properly sometimes

Last post 04-12-2006 6:17 PM by davidebb. 2 replies.

Sort Posts:

  • [BUG]Sys.Net.WebRequest.createUrl doesn't work properly sometimes

    04-11-2006, 5:33 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello.

    this is a bug i found in the sequence of this bug:

    http://forums.asp.net/thread/1254898.aspx

    ok, so if you have a dataService that is calling a web service and you're not sending parameters, then there's a problem in the way the query string is built. for instance, i have this declaration on my page:

    <dataSource id="mySource" autoLoad="true" serviceURL="WebService.asmx?mn=ObtemAlunos" serviceType="Handler" />

    the problem is that i get a GET request with this url:

    GET /codigo/cap06/WebService.asmx?mn=ObtemAlunos&

    the problem is that the the Sys.Net.WebRequest.createUrl adds the url returned from the Sys.Net.WebRequest.createQueryString without checking for the length of the returned string. in my previous scenario, the _parameters object of the datasource class is created as an empty object (which is different from null) and due to that, the createQueryString is returning an empty string.

    i think that the Sys.Net.WebRequest.createUrl should be changed so that it looks like this:

    Sys.Net.WebRequest.createUrl = function(url, queryString) {
    if (!queryString) {
      return url;
    }

    var sep = '?';
    if (url && url.indexOf('?') != -1)
       sep = '&';


    var string = Sys.Net.WebRequest.createQueryString(queryString);
    if( string != null && string.length != 0 )
       return url + sep + Sys.Net.WebRequest.createQueryString(queryString);
    else
     
    return url;
    }

     

    thanks.

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: [BUG]Sys.Net.WebRequest.createUrl doesn't work properly sometimes

    04-12-2006, 12:51 PM
    • All-Star
      25,662 point All-Star
    • Luis Abreu
    • Member since 02-12-2005, 6:22 AM
    • Madeira [Portugal]
    • Posts 5,368
    • TrustedFriends-MVPs

    hello again.

    any thoughts on this?

    --
    Regards,
    Luis Abreu
    email: labreu_at_gmail.com
    EN blog:http://msmvps.com/blogs/luisabreu
  • Re: [BUG]Sys.Net.WebRequest.createUrl doesn't work properly sometimes

    04-12-2006, 6:17 PM
    • Contributor
      5,771 point Contributor
    • davidebb
    • Member since 06-11-2002, 8:31 AM
    • Redmond, WA
    • Posts 1,150
    • AspNetTeam

    Thanks Luis, I will open a bug to track this.

    David

Page 1 of 1 (3 items)