CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 3/9/2005 2:28:15 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 1 Views: 24 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
2 Items, 1 Pages 1 |< << Go >> >|
Aris
Asp.Net User
How to solve my problems?3/9/2005 2:28:15 AM

0/0

Hi all,

How to use the User.Identity.IsAuthenticated within the Custom Control code behind? I designed a Top menu with 10 buttons which 4 buttons visible at logged in. Here is my code

--- Top menu ascx

<%@ control LANGUAGE="VB" Inherits="topmenu" src="topmenu.vb"%>
<asp:LinkButton ID="lnk_1" text="B1" Runat="server" onclick="fnclick"/> |
<asp:LinkButton ID="lnk_2" text="B2" Runat="server" onclick="fnclick"/> |
<asp:LinkButton ID="lnk_3" text="B3" Runat="server" onclick="fnclick"/> |
<asp:LinkButton ID="lnk_4" text="B4" Runat="server" onclick="fnclick"/> |
<asp:LinkButton ID="lnk_5" text="B5" Runat="server" onclick="fnclick"/> |
<asp:LinkButton ID="lnk_6" text="B6" Runat="server" onclick="fnclick"/> |
<asp:LinkButton ID="lnk_7" text="B7" Runat="server" onclick="fnclick" visible=false/> |
<asp:LinkButton ID="lnk_8" text="B8" Runat="server" onclick="fnclick" visible=false/> |
<asp:LinkButton ID="lnk_9" text="B9" Runat="server" onclick="fnclick" visible=false/> |
<asp:LinkButton ID="lnk_10" text="B10" Runat="server" onclick="fnclick" Visible=false/>

--- Top Menu vb
Imports System
Imports System.web
Imports System.web.ui
Imports System.web.ui.webcontrols
Imports System.Web.Security

PUBLIC MustInherit CLASS topmenu : INHERITS System.Web.UI.UserControl
Protected WithEvents lnk_7 As linkbutton
Protected WithEvents lnk_8 As linkbutton
Protected WithEvents lnk_9 As linkbutton
Protected WithEvents lnk_10 As linkbutton

Dim FMID As FormsIdentity

OVERRIDABLE SUB PAGE_LOAD
If User.Identity.IsAuthenticated Then
FMID = User.Identity
IF NOT ISPOSTBACK THEN
response.write("Hello , " & FMID.Ticket.userdata.trim())
lnk_7.visible=true
lnk_8.visible=true
lnk_9.visible=true
lnk_10.visible=true
END IF
end if
END SUB

sub fnclick (s as object, e as eventargs)
FormsAuthentication.SignOut()
end sub

END CLASS

If I use in Page it works fine. however I convert to Custom Control & got an error : Name 'User' is not declared. How to fix it? I need to check the user logged in or not to visible buttons. Thanks a lot!

Aris
imagemaker
Asp.Net User
Re: How to solve my problems?3/9/2005 2:08:47 PM

0/0

When not in the code-behind of your page class use:

If HttpContext.Current.User.Identity.IsAuthenticated Then
'user is authenticated
End If

If you have not already done so, you will need to import the System.Web namespace to have access to HttpContext.

HttpContext.Current will also give you access to the Request, Response, Session, Cache, etc. objects as well.
Bill, WESNet Designs
2 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
The Language of Letting Go Journal: A Meditation Book and Journal for Daily Reflection Authors: Melody Beattie, Pages: 400, Published: 2003
The Road Less Traveled: A New Psychology of Love, Traditional Values, and Spiritual Growth Authors: M. Scott Peck, Pages: 320, Published: 2002
My Houseful of Hints: How to Solve Problems at Home and Away Authors: Doris B. Gill, Pages: 176, Published: 1989
The Language of Letting Go: Daily Meditations for Codependents Authors: Melody Beattie, Pages: 393, Published: 1990
The Anxiety & Phobia Workbook Authors: Edmund J. Bourne, Pages: 432, Published: 2005
The New Meditation Handbook: Meditations to Make Our Life Happy and Meaningful Authors: Geshe Kelsang Gyatso, Pages: 224, Published: 2003
Christian Reflections Authors: C. S. Lewis, Walter Hooper, Pages: 190, Published: 1994
Codependent No More: How to Stop Controlling Others and Start Caring for Yourself Authors: Melody Beattie, Pages: 250, Published: 1992

Web:
solve my problems The current goal: solve my problems Very similar goal: (or Cancel). Meaning is slippery, but try to only add goals that have nearly identical meanings. ...
Will adding RAM to my system solve my problems? - Ask Leo! Windows loves RAM, but whether or not adding RAM will resolve the issues you're experiencing depends on the issues. We'll look at an example.
Social Innovation camp: Designer - solve my problem! | Media ... Social Innovation camp: Designer - solve my problem! This article was first published on guardian.co.uk on Saturday April 05 2008. ...
Will God Solve My Problems? Feb 26, 2008 ... Maybe you're wondering right now, if I become a Christian will God solve my problems? No. At least that's not what my Bible says. ...
WAPT Forum -> How to solve my problem Forum Home, Search, Help, Usage Questions, |-- How to solve my problem, |-- Test Scenario Creation, |-- User Session Emulation, |-- Functions Usage ...
Solve my problem someone please?it is about my teacher who is ... my teacher is so strict. she always says i put les…
Nobody can solve my problem???? | drupal.org Nobody can solve my problem???? Deprecated - Drupal core · Drupal 5.x · manmohanghai_mca - June 17, 2008 - 06:27. I'm customizing the user profile with the ...
I CANT SOLVE MY PROBLEM.PLEASE HELP :( - THE DAEMONS HOME I CANT SOLVE MY PROBLEM.PLEASE HELP :( General Hardwaretalk.
please solve my problem please solve my problem Ali GUNER. Re: please solve my problem Paco Hope. Re: please solve my problem David Coppit. Re: please solve my problem Diego Calp ...
Your "solution" doesn't solve my problem | Free exchange ... Entry for December 18, 2006: Your "solution" doesn't solve my problem. « Previous post · Free exchange home · Next post » ...

Videos:
Solve My Problem I am the girl Standing on the cliff Measure my angle of depression Solve my problem or I'll pull the trigonometry And throw myself indice
Earn $1000 Gift Certificate My Helping Me Solve My Problem If you can provide a solution for Dr. Mercola's challenge you will have $1000 certificate to spend on anything in his store.
How Do I Solve My Cash Flow Problems? Real estate investment expert, Joe Crump, teaches zero down investing techniques. Learn foreclosures, short sales, subject to, land contracts, multi-...
Collins Kids - Problems, Problems, Problems Problems, problems, problems all day long Will my problems work out right or wrong My baby don't like anything I do-o-o My teacher seems to feel the ...
Ulcer and Stomache Problems I have heartburn and stomach ulcer, what do you recommend to solve my problem?
Oasis - Solve My Mystery Amazing B-Side By Oasis (check my account for more rare Oasis Songs) sound problem 0.40
My problem with Flyff : Fly for Fun *READ THIS FIRST PLEASE* Okay. I'd rather not have all people pm me about solutions, as you can see in this video, I DUNNO HOW TO SOLVE IT. Stop pmm...
Lucky Luke & Les Daltons en cavale I'm a poor lonesome cowboy I'm a long long way from home And this poor lonesome cowboy Has got a long long way to roam Over mountains over prairies F...
help solve my hycam2 problem my hycam2 not work fullscreen while i play game or applications please comment it
This Helps Solve The 1.1.3 Downgrade To 1.1.1 problem (EASY) SORRY FOR THE FAST SPEED CLIPS! JUST PAUSE ON EACH ONE! This is the easiest way currently on how to downgrade from 1.1.3 to 1.1.1 on your ipod or ip...




Search This Site:










secure ftp

setting the location of ...

template control inside repeater.

how to expose a property for a dynamically built control?

using the url/params object to store state in a custom control

metabuilders rowselectorcolomn for .net 1.0 wanted

web custom controls - calling control

hosting sharepoint server 2007

callback question in vs2005 april ctp

session variable as custom control problem...

problem with datagrid checkbox column checkedchange event

http://www.freewebdot.com/

.net 3.5 hosting requirements

calendarpopup component

any reasons to stay clear of [www.planetsmb.com]

looking for a good tutorial

reliablesite.net - :( so far not too good

how to host an asp.net 2.0 website on 2003 server iis 6.0

adding a textbox in a table

design time error with arraylist property

custom datagridcolumn

render won't render...

why is the control rendering a property as an attribute?

problem: sample of htmltextwriter class

connecting to outlook

don't use global internet solutions as web hoster

a customed tab control

programmatically adding/removing controls at design time

extending the asp:literal control

runtime exception with enumconverter

  Privacy | Contact Us
All Times Are GMT