Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Hide or display label ot object based on url values

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

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
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.
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Screencast - Getting to Know the Pipeline
Suggested Courses

885 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