Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/CloudIngenium.com/htdocs/wp-includes/functions.php on line 6114
How do you read a parameter from the URL? – Knowledge eXchange

How do you read a parameter from the URL?

I am trying to use the login.aspx page in such a way that when a
user tries to access any given page, it will redirect them to the login screen
if they are not authenticated and after a successful authentication go back to
the page they were trying to access. My issue is that when I go to the page and
get redirected, I don’t go back to the page I came from. Here is a sample of
what my login.aspx page has for an URL:

http://localhost/Login.aspx?ReturnUrl=/OtherPage.aspx

As you can tell, ASP.Net is smart enough to include the return to
URL, however, how can I make use of that to redirect my users back to that page? Also, in general, how can you read a parameter in the URL query string?

Thanks!


The following code would address the issue. Note that you can read any Paramater by doing a QueryString from the Request. ReturnUrl is the one that pertains to this particular example:

if (Request.QueryString["ReturnUrl"] != null)

{

string ReturnUrl = Request.QueryString["ReturnUrl"].Trim();

//Navigate to the ReturnUrl

}

else

//Navigate to a specific home page

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.