Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# Login control - best practice to disable links till users log in 1

Status
Not open for further replies.

Gzk2010

Programmer
Aug 17, 2010
48
0
0
US
Server Error in '/' Application.
--------------------------------------------------------------------------------

New at c# asp.net .

C# Login control - best practice to disable links till users log in.
Using the login control. I notice if the user does not log in and click a link they get an ugly page below. what is the best practice to disable web controls and links till login?

what they see if click link when not logged in:

The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.

Requested URL: /Security/~/aBuy.aspx
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
 
You'll probably get a better response in the ASP .NET forum, but anyhow:

You can disable the links but that wouldn't stop people that are not logged in from being able to type in the URL manually. If you don't like the 404 error page you can set up your own nice user-friendly error pages. (Google 'custom asp .net error pages' for lots of help there)

To disable a web-control I think the syntax is myControl.enabled = false;

Any javascript that redirects should really be checking that the user is logged in as well.

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top