if URL contains, then execute
up vote
-1
down vote
favorite
I have the following code:
else if (url == $"Link" + "?rerror=2")
// do something here
The user inputs "Link", then the program navigates to that link. I then want the program to determine if the url contains "?rerror=2" on the end of the url, to do something else.
c# url
add a comment |
up vote
-1
down vote
favorite
I have the following code:
else if (url == $"Link" + "?rerror=2")
// do something here
The user inputs "Link", then the program navigates to that link. I then want the program to determine if the url contains "?rerror=2" on the end of the url, to do something else.
c# url
Have you triedelse if (url.Contains("?rerror=2"))orelse if (url.EndsWith("?rerror=2"))?
– Rufus L
Nov 9 at 21:04
thank you, I finally got it! I did else if (driver.Url.Contains("?rerror=2")) and it worked. I apperciate the help!
– Caden Buckelew
Nov 9 at 21:29
1
Possible duplicate of How can I check if a string exists in another string
– Rufus L
Nov 9 at 21:45
usestring.EndsWith(string)
– Juan Salvador Portugal
Nov 10 at 2:27
add a comment |
up vote
-1
down vote
favorite
up vote
-1
down vote
favorite
I have the following code:
else if (url == $"Link" + "?rerror=2")
// do something here
The user inputs "Link", then the program navigates to that link. I then want the program to determine if the url contains "?rerror=2" on the end of the url, to do something else.
c# url
I have the following code:
else if (url == $"Link" + "?rerror=2")
// do something here
The user inputs "Link", then the program navigates to that link. I then want the program to determine if the url contains "?rerror=2" on the end of the url, to do something else.
c# url
c# url
edited Nov 10 at 1:13
Navarasu
1,7801721
1,7801721
asked Nov 9 at 20:56
Caden Buckelew
166
166
Have you triedelse if (url.Contains("?rerror=2"))orelse if (url.EndsWith("?rerror=2"))?
– Rufus L
Nov 9 at 21:04
thank you, I finally got it! I did else if (driver.Url.Contains("?rerror=2")) and it worked. I apperciate the help!
– Caden Buckelew
Nov 9 at 21:29
1
Possible duplicate of How can I check if a string exists in another string
– Rufus L
Nov 9 at 21:45
usestring.EndsWith(string)
– Juan Salvador Portugal
Nov 10 at 2:27
add a comment |
Have you triedelse if (url.Contains("?rerror=2"))orelse if (url.EndsWith("?rerror=2"))?
– Rufus L
Nov 9 at 21:04
thank you, I finally got it! I did else if (driver.Url.Contains("?rerror=2")) and it worked. I apperciate the help!
– Caden Buckelew
Nov 9 at 21:29
1
Possible duplicate of How can I check if a string exists in another string
– Rufus L
Nov 9 at 21:45
usestring.EndsWith(string)
– Juan Salvador Portugal
Nov 10 at 2:27
Have you tried
else if (url.Contains("?rerror=2")) or else if (url.EndsWith("?rerror=2"))?– Rufus L
Nov 9 at 21:04
Have you tried
else if (url.Contains("?rerror=2")) or else if (url.EndsWith("?rerror=2"))?– Rufus L
Nov 9 at 21:04
thank you, I finally got it! I did else if (driver.Url.Contains("?rerror=2")) and it worked. I apperciate the help!
– Caden Buckelew
Nov 9 at 21:29
thank you, I finally got it! I did else if (driver.Url.Contains("?rerror=2")) and it worked. I apperciate the help!
– Caden Buckelew
Nov 9 at 21:29
1
1
Possible duplicate of How can I check if a string exists in another string
– Rufus L
Nov 9 at 21:45
Possible duplicate of How can I check if a string exists in another string
– Rufus L
Nov 9 at 21:45
use
string.EndsWith(string)– Juan Salvador Portugal
Nov 10 at 2:27
use
string.EndsWith(string)– Juan Salvador Portugal
Nov 10 at 2:27
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53233173%2fif-url-contains-then-execute%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you tried
else if (url.Contains("?rerror=2"))orelse if (url.EndsWith("?rerror=2"))?– Rufus L
Nov 9 at 21:04
thank you, I finally got it! I did else if (driver.Url.Contains("?rerror=2")) and it worked. I apperciate the help!
– Caden Buckelew
Nov 9 at 21:29
1
Possible duplicate of How can I check if a string exists in another string
– Rufus L
Nov 9 at 21:45
use
string.EndsWith(string)– Juan Salvador Portugal
Nov 10 at 2:27