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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to disable panel in ASP.Net using C# code behind..

Status
Not open for further replies.

suthaharmca

Programmer
Feb 4, 2008
2
i'm new to ASP.Net
i'v developed an ASP.Net website
the index page holds a login panel
an existing user can login and he 'll b directed to a
welcome page

if the user returns back to the index page by clicking the home menu in the welcome page the index page should load without the login panel..i tried to remove but i was struked..
plz help 2 come out from this...
 
K i tried .visible property..
but i'm not sure where to use this code
whether in the click event of index form
r click event of 2nd form...how to disable the panel which is in the index page but the click event is made in the 2nd page...

if i add the code

panel1.visible=false;

in the form load event of index page then every time though a user had no log in the panel 'll b hided...
 
You'll need to record somewhere that the user is logged in and then set the property based on that. How you do this will depend on what authentication methods you are using.


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
are you using forms authentication? have you configured this in the web.config? if so you shouldn't need any special logic on a given page to login.

I would setup the app this way
file structure...
default.aspx
loging.aspx
other pages/directories

Code:
<authentication mode="forms">
   <forms login="login.aspx" />
   ... other forms based authentication attributes
</authentication>
<authorization>
   <allow user="*" />
   <deny user="?" />
</authorization>

<location name="login.aspx">
   <authorization>
      <allow users="?" />
   </authorization>
</location>
this might not be exact, but gets you started.

when a user attempts to access any secure page they will be redirected to the ~/login.aspx page. anybody can view the login page. only authenticated users can access the rest of the site.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top