Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Hide or display label ot object based on url values

Posted on 2013-06-28
4
Medium Priority
?
329 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 2000 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
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.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

664 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