?
Solved

Cannot Keep my http session state asp.net when response.redirect

Posted on 2004-10-07
16
Medium Priority
?
430 Views
Last Modified: 2006-11-17
Hi, I have 2 aspx file. The first one is the login one. When the connection is ok it make a response.redirect to my official page. The prob, is that in my login page i create some session keys and when i load my second page the value of theses keys are null.... why's that ??? :S

this is the code for my login page where my session is created:
******************************************************************************
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


        'Si on load pas pour la première fois
        If IsPostBack Then
             ChangerTexte(ddlLangue.SelectedItem.Value)

            'On vérifie si l'usager à le droit de se loguer
            If Me.VerifLogin Then
                Me.lErreur.ForeColor = Me.lErreur.ForeColor.Lime
                Me.lErreur.Text = "Connexion en cours veuillez patientez..."

                ChangerTexte(ddlLangue.SelectedItem.Value)

                'On rajoute les session
                Session.Add("LogValide", True)

                Me.Response.Redirect("PrixFontaine.aspx", False)

            End If

        End If

    End Sub
******************************************************************************


this is a function in my second page:
******************************************************************************
Private Function VerifAutorisation() As Boolean

        Dim Autorisation As Boolean
        'on vérifie si l'utilisateur à le droit de voir les données
        Autorisation = Session.Item("LogValide")

        If Autorisation Then
            Return True
        Else
            dectectionErreurActive(True)
            lGestionDocument.Text = ("Vous n'êtes pas autoriser à utiliser ce logiciel")
            Return False
        End If

    End Function
******************************************************************************


I think that's not the same session in my second page, but how can i load the variables of my first page without using cookies...

Thx for the help :)
0
Comment
Question by:denzmor
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
16 Comments
 
LVL 8

Expert Comment

by:razo
ID: 12248578
try
 Session("LogValide")="TRUE"
and
  Autorisation = ctype(Session("LogValide"),boolean)
0
 
LVL 1

Author Comment

by:denzmor
ID: 12248659
Sorry it doesn't work...

On thing i forgot to mention is that when i compile and test in visual studio it work perfectly( and he using internet explorer as default web browser), i mean the session variable are keeping there values...  but when i run a Internet explorer alone without using visual studio it doesn't work the values are not passed...

so :S
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12248904
Dim Autorisation As String
Autorisation = ctype(Session("LogValide"),String)


 If Autorisation=="True" Then
            Return True

try that...it is very starage that it works from vs.net and not from IE...






0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:denzmor
ID: 12249358
It work in my visual studio like the boolean version but i have an error when i'm using my web browser alone, it trow an System.NullReferenceException at line 234. That means that the variable did not pass the session :S

Ligne 232 :        Autorisation = CType(Session("LogValide"), String)
Ligne 233 :
Ligne 234 :        If Autorisation.Equals("True") Then
Ligne 235 :            Return True
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12249452
check what does authorization contaion after line 232..in debug mode

0
 
LVL 1

Author Comment

by:denzmor
ID: 12249659
it contain = ""
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12249676
Session("LogValide") - check what this contains....
0
 
LVL 1

Author Comment

by:denzmor
ID: 12249804
same thing :S

very weirdo... in visual studio it contain "True" and  without visual studio there's nothing in it...

0
 
LVL 15

Expert Comment

by:praneetha
ID: 12249904
are you going thru the first page from IE...

i mean that is really weird...see if your cookies are disabled...

and try from another comp in your intranet and see if it works...

0
 
LVL 1

Author Comment

by:denzmor
ID: 12250844
nope doesn't work :S
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12250903
how do u know that...

"without visual studio there's nothing in it..."

bcz it throws an exception...insert your code between try and catch and print the exception it throws...

print that using Response.write()



0
 
LVL 1

Author Comment

by:denzmor
ID: 12251054
I found the solution !!!

When in go in the web.config file, i've change the Value of "Cookieless = "true" and now it work. He keep in the url the name of the session id and transfert it to my new page.

Thx for the help anyway praneetha

:)
0
 
LVL 15

Expert Comment

by:praneetha
ID: 12251079
u r welcome... but that still does not explain why it was not working...

so that means the computer u were using ..cookies were disabled in it....
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 12572758
PAQed with no points refunded (of 100)

modulo
Community Support Moderator
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question