Solved

Hide or display label ot object based on url values

Posted on 2013-06-28
4
325 Views
Last Modified: 2013-06-28
I am trying to display a label on the Login.aspx page based on the access denied values that are produces when a user clicks a links to a page that requires a login. My code is below.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

        If Request.QueryString("ReturnUrl").ToString() = "%2fefitnessplanner_dev%2fworkouts_saved.aspx" Then

 Label1.Visible = True

        Else : Label1.Visible = False

        End If

    End Sub

Admiitedly I have not done much code writing on this project so I am not sure if the code is accurate. I do not get a compile/build error. The problem is the label displays regardless of what link I click. Is my syntax right. Should I write it another way. The following is the entire url return value:

http://localhost/efitnessplanner_dev/(S(13hshoxd1kfnomtl2ldfn5kg))/login.aspx?ReturnUrl=%2fefitnessplanner_dev%2fworkouts_saved.aspx

If I can get past this hurdle it will help me with this project greatly. Thanks for your help in advance.
0
Comment
Question by:derrekdeveloper
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 

Author Comment

by:derrekdeveloper
ID: 39284937
I have also tried this approach with contains in the code. The label still displays when it should not:

 If Request.QueryString("ReturnUrl").Contains("%2fefitnessplanner_dev%2fworkouts_saved.aspx") Then

            Label1.Visible = True

        Else : Label1.Visible = False



        End If

    End Sub
0
 
LVL 35

Accepted Solution

by:
Robert Schutt earned 500 total points
ID: 39285680
The contents of the QueryString you're testing against are decoded automatically. So the contents in this case would be "/efitnessplanner_dev/workouts_saved.aspx".
0
 

Author Comment

by:derrekdeveloper
ID: 39285753
This is great! Solved the issue immediately!!! Thank you.
0
 

Author Closing Comment

by:derrekdeveloper
ID: 39285757
Solved the issue immediately! Worked great!!!
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question