Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Help! Users "randomly" getting logged outHelp! Users "randomly" getting logged out
Previous
 
Next
New Post
1/28/2007 9:33 PM
 

Hi all,

I solved the problem using these code:

<script language="VB" runat="server">
    Sub Application_EndRequest(ByVal s As Object, ByVal e As EventArgs)
        Dim SiteNameURL As Object
        Dim Context As HttpContext = CType(s, HttpApplication).Context
        Dim Response As HttpResponse = Context.Response
        'Request domain name
        SiteNameURL = Request.ServerVariables.Item("SERVER_NAME")
        'Get components of domain name
        Dim urlarray() As String = Split(SiteNameURL, ".", , CompareMethod.Text)
        'Create domain name for cookie
        Select Case urlarray.Length
            Case 2
                SiteNameURL = "." + SiteNameURL
            Case 3
                SiteNameURL = "." + urlarray(1) + "." + urlarray(2)
            Case Else
                SiteNameURL = "." + urlarray(urlarray.Length - 2) + "." + urlarray(urlarray.Length - 3)
        End Select
        'Set domain to cookies
        If Response.Cookies.Count > 0 Then
            For Each cookie As String In Response.Cookies.AllKeys
                Dim name As String = cookie.ToString.ToUpper
                Select Case name
                    'Should use your own cookie names
                    Case ".ASPXANONYMOUS", "ASP.NET_SESSIONID", "LANGUAGE", ".DOTNETNUKE", "PORTALALIASID", "PORTALROLES"
                        'Uncomment next line to disable Httponly cookies
                        'Response.Cookies(cookie).HttpOnly = False
                        'Set domain
                        Response.Cookies(cookie).Domain = SiteNameURL
                        'Set path, change DNN to your DotNetNuke installation folder or leave just “/”
                        Response.Cookies(cookie).Path = "/"
                End Select
            Next
        End If
    End Sub
</script>

 

I tested it creating 10 new pages in a row on brinkster. I found it on this same post but it has an error on the cookie path.

 
New Post
3/2/2007 8:32 AM
 
Hi, I inserted this code to global.asax and got this error :

Index was outside the bounds of the array.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IndexOutOfRangeException: Index was outside the bounds of the array.

I'm running DNN 3.3.7 under localhost, by the way.
 
New Post
3/2/2007 10:41 AM
 

Hi duchoangle,

 

I think this is because the code "splits" you domain name based on the dots (".") and because you don't have any dots in "localhost" it throws an error. You can try this:

  • Remove the code from global.asax because in my experience you don't need the code to preserve sessions in localhost
  • If still you need to keep the code replace:

this:

SiteNameURL = Request.ServerVariables.Item("SERVER_NAME")
        'Get components of domain name
        Dim urlarray() As String = Split(SiteNameURL, ".", , CompareMethod.Text)
        'Create domain name for cookie
        Select Case urlarray.Length
            Case 2
                SiteNameURL = "." + SiteNameURL
            Case 3
                SiteNameURL = "." + urlarray(1) + "." + urlarray(2)
            Case Else
                SiteNameURL = "." + urlarray(urlarray.Length - 2) + "." + urlarray(urlarray.Length - 3)
        End Select

with this:

        SiteNameURL = "." & Request.ServerVariables.Item("SERVER_NAME")

I strongly recommend that you use the first option because I didn't test the code replacement and it may not work.

Post your results.

Greetings

 
New Post
3/2/2007 11:19 PM
 
Thanks for the response avvweb . However, changing the code prevented me from logging in. And for your experience that localhost doesn't need preserving session, well, being kicked out during editing still happens very frequently.

I think cathal is revising this problem. See this for details.

Best regards,
Duc
 
New Post
3/21/2007 4:01 PM
 

I noticed you mentioned you are using dnnexports.faq module - I cannot seem to find a place that allows me to download this module.  I went to dnnexperts.com, but cannot download it from there.  Any pointers?

 

Thanks - you can email me at shaunam@cox.net

 

 

 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Administration ...Administration ...Help! Users "randomly" getting logged outHelp! Users "randomly" getting logged out


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out