Master Page issues and page refreshing

S

SAL

Hello,
We are designing a single logon site wide system here at my work. When my
page opens it checks for the existance of a cookie that another of our web
guys sets. It the cookie is present, I hit his webservice to get the user's
name. If the user is authenticated, I log them in using FormAuthentication.
All this seems to be working as expected and once the user is logged in, the
user is permitted to do that which has been defined via Roles in the
aspnetdb database and via my web.sitemap.
The problem is, the user is logged in and the sitemap doesn't refresh
without hitting the refresh button on the browser.
I'm doing all of the checking and logging users on in my master page. My
masterpage inherits from a class that inherits from
System.Web.UI.MasterPage.

I've tried several things to solve this problem such as,
redirecting to the requested URL to force a page refresh.
Calling the code for checking and logging on in different page events in the
Masterpage such as:
Page Load
Page Init
Page PreRender

None of them seem to solve this problem though. I'm fairly certain that most
of the problem is my lack of understanding about how things are occuring or
the order in which they are occuring.

I have a Table of Contents on the left side of the page that uses Repeater
that binds to a TableAdapter. The Repeater actually uses a business class
that returns the TableAdapter using rules according to the role the user is
loggin as. This also doesn't refresh properly just like the Menu which is
bound to my web.sitemap using the sitemap provider.

The code I'm using is as follows and is located in the MastePageBase.vb file
which the MasterPage inherits from:
This is called from the MasterPage's Load event.
Protected Sub ValidateLoggedIn()
If Session(CUR_USER) Is Nothing Then
If UserLoggedIn() Then
'Page.DataBind() ' I tried this but it didn't make a
difference
Response.Redirect(Request.Url.ToString())
End If
End If
End Sub

Public Function UserLoggedIn() As Boolean
If Not Session(CUR_USER) Is Nothing Then Return True

Dim cookieval As String = Nothing
Dim ccws As New checkCredentialsWS.checkCredentialsWS
If Not Request.Cookies(Searchs.JSESSIONID) Is Nothing Then
cookieval = Request.Cookies(Searchs.JSESSIONID).Value
End If
If cookieval Is Nothing Then
' For Production *************
Dim sred As String =
ConfigurationManager.AppSettings(LOGINPAGE_URL)
If Not sred Is Nothing Then ' Redirect them to the
login page
Response.Redirect(sred & "&postbackURL=" &
Request.Url.ToString())
End If
End If

If ccws.isLoginCookieIDMatch(cookieval) Then
Dim user As String = ccws.getUserName(cookieval)
If Not user = "" Then
FormsAuthentication.SetAuthCookie(user, False)
Session(CUR_USER) = user
Session(user) = True
End If
End If
End Function

Any help here is much appreciated.

S
 
A

Allen Chen [MSFT]

Hi SAL,

I have one thing unclear about your scenario. Could you clarify it first?

Quote from SAL ==================================================

The problem is, the user is logged in and the sitemap doesn't refresh
without hitting the refresh button on the browser.
==================================================

By "the sitemap doesn't refresh" do you mean you want to refresh the Menu
control on the page? If so I think you need it be switched from status 1 to
status 2, right? Then what the status 1 and status 2 are?

For now the suggestion I could provide is, if you're using the Login
control, you can try to redirect in the LoggedIn event handler of the Login
control. I think it should have the same effect as clicking the refresh
button of the browser.

If it still doesn't work please send me a demo that can reproduce this
problem (From your description your project seems very complicated. If it's
possible please send me a minimal repro). Please update here after sending
the project in case I missed that email.

Regards,
Allen Chen
Microsoft Online Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
S

SAL

Hi Allen. Thanks for you response.

I got it figured out. It was just a little logic error.
The logic of doing the Response.Redirect back to the page does indeed work
as you suggest.

S
 
A

Allen Chen [MSFT]

Glad to know that. Have a nice day!

Regards,
Allen Chen
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
=================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top