How to get the QueryString? [SOLVED]

Please post public support tickets here. Note: for private support tickets, please send an email to support@cshtml5.com instead.
h82258652
Posts: 12
Joined: Fri Jun 12, 2015 6:23 pm

How to get the QueryString? [SOLVED]

Postby h82258652 » Wed Sep 30, 2015 7:52 am

I want to get the query string for the url. But I don't know how to do this, is any code or sample can help me? :(

JS-Support @Userware
Site Admin
Posts: 1142
Joined: Tue Apr 08, 2014 3:42 pm

Re: [Need Support]How to get the QueryString?

Postby JS-Support @Userware » Wed Sep 30, 2015 8:39 am

Hi,

Sure!

To get the query string, please use the following method:

Code: Select all

public static string GetQueryString()
{
    if (CSharpXamlForHtml5.Environment.IsRunningInJavaScript)
    {
        string url = JSIL.Verbatim.Expression("window.location.toString()");
        string queryString = (url.IndexOf('?') >= 0 ? url.Substring(url.IndexOf('?') + 1) : "");
        return queryString;
    }
    else
    {
        MessageBox.Show("The query string cannot be obtained when running inside the Simulator.");
        return "";
    }
}

Regards,
JS-Support

h82258652
Posts: 12
Joined: Fri Jun 12, 2015 6:23 pm

Re: [Need Support]How to get the QueryString?

Postby h82258652 » Wed Sep 30, 2015 9:08 pm

JS-Support wrote:Hi,

Sure!

To get the query string, please use the following method:

Code: Select all

public static string GetQueryString()
{
    if (CSharpXamlForHtml5.Environment.IsRunningInJavaScript)
    {
        string url = JSIL.Verbatim.Expression("window.location.toString()");
        string queryString = (url.IndexOf('?') >= 0 ? url.Substring(url.IndexOf('?') + 1) : "");
        return queryString;
    }
    else
    {
        MessageBox.Show("The query string cannot be obtained when running inside the Simulator.");
        return "";
    }
}

Regards,
JS-Support


Thanks a lot!


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 42 guests

 

 

cron