Created
May 24, 2016 10:45
-
-
Save Phuseos/8df8b66e6b9c8f6334f62b78339bd6b9 to your computer and use it in GitHub Desktop.
String matching in current URL (C#)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected void ahrefOut_Click(object sender, EventArgs e) | |
{//Logout button | |
//Get the current absolute URL of the ContentPlaceHolder | |
string AbsoluteURL = BodyContent.Page.Request.Url.AbsoluteUri; | |
//Set the string to search for in the URL | |
string strCheck = "Test"; | |
//If the URL contains (part of) the string to check redirect to special login page | |
if (AbsoluteURL.Contains(strCheck)) | |
Response.Redirect("LoginTest.aspx"); | |
//Otherwise, redirect to standard login | |
else | |
Response.Redirect("Login.aspx"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment