Solved

Hide or display label ot object based on url values

Posted on 2013-06-28
4
321 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
  • 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

809 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