Showing posts with label default. Show all posts
Showing posts with label default. Show all posts

Saturday, March 31, 2012

Session Timeouts

Which Session Timeout property is used by default.
Is it the one in IIS (900 seconds)
Machine.config (20 mins)
or
Web.config (20 mins)
Could someone explain how this works.
Or is it IIS just because that ends first?
Thanksasp.net does not use the IIS session - these are for classic asp
true session timeout only occurs with the inproc session manager running in
your app domain. for its configuration it defaults to machine.config, but
web.config overrides it , like all settings (unless overriding
machine.config has been disabled).
-- bruce (sqlwork.com)
"BillGatesFan" <klj_mcsd@.hotmail.com> wrote in message
news:1103664141.963104.39250@.z14g2000cwz.googlegroups.com...
| Which Session Timeout property is used by default.
|
| Is it the one in IIS (900 seconds)
|
| Machine.config (20 mins)
|
| or
|
| Web.config (20 mins)
|
| Could someone explain how this works.
| Or is it IIS just because that ends first?
|
| Thanks
|
BillGatesFan..
I have also asked this question once..
But after my research..i think Web.Config..overrides all of them.
Patrick
*** Sent via Developersdex http://www.examnotes.net ***
Don't just participate in USENET...get rewarded for it!

Session Timeouts

Which Session Timeout property is used by default.

Is it the one in IIS (900 seconds)

Machine.config (20 mins)

or

Web.config (20 mins)

Could someone explain how this works.
Or is it IIS just because that ends first?

Thanksasp.net does not use the IIS session - these are for classic asp

true session timeout only occurs with the inproc session manager running in
your app domain. for its configuration it defaults to machine.config, but
web.config overrides it , like all settings (unless overriding
machine.config has been disabled).

-- bruce (sqlwork.com)

"BillGatesFan" <klj_mcsd@.hotmail.com> wrote in message
news:1103664141.963104.39250@.z14g2000cwz.googlegro ups.com...
| Which Session Timeout property is used by default.
|
| Is it the one in IIS (900 seconds)
|
| Machine.config (20 mins)
|
| or
|
| Web.config (20 mins)
|
| Could someone explain how this works.
| Or is it IIS just because that ends first?
|
| Thanks
|
BillGatesFan..
I have also asked this question once..
But after my research..i think Web.Config..overrides all of them.
Patrick

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Thursday, March 29, 2012

session value lost

Hello NG,

I have three files (default.aspx, search.aspx and work.aspx). The way
is: login on default (if session is newsession). The loginname I write
into as sessionvariable (username). So I redirect to my search.aspx.
Here I have a form which allows fill in some fields (place, street,
name etc.). With this informations i build a sqlquerey for sqlserver,
fill a datagrid and after select the right record by usin a link behind
I save the recordid to the session and redirect to work.aspx. With a
new sqlstring I fetch the data from the sqlserver. But this data is
only to display. The user can edit Data for a new record in anoter
table and end it wiht button click. Here I will save all sessionvalues
(username, and recordinformation) with sqlstring and redirect to
search.aspx.

Now the problems:
1. I don't no what I've changed - but I have to...
After redirection from work to search I've got an sql-error. The string
will be cleard before building new, so why does it run once, but not
after redirect?
2. I solved this problem with redirecting from work to default. Its
running. But: the session username is empty - why?
3. I solved with writing the username in an hidden field on
default.aspx, read it again and write to session. Everything is fine.
4. Now we can work, and I will change the username from manuel login to
reading from client windows. But I realy want to know why I have the
Problems 1 to 3 and problem no 4 is: some stored records have no
username within. Who can explain it to me - who as a solution to solve
the problems?You might want to share the source code for your search.aspx page so
we can look it over.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 27 Jun 2005 07:46:30 -0700, "catweezle2010" <catweezle2010@.gmx.de>
wrote:

>Hello NG,
>I have three files (default.aspx, search.aspx and work.aspx). The way
>is: login on default (if session is newsession). The loginname I write
>into as sessionvariable (username). So I redirect to my search.aspx.
>Here I have a form which allows fill in some fields (place, street,
>name etc.). With this informations i build a sqlquerey for sqlserver,
>fill a datagrid and after select the right record by usin a link behind
>I save the recordid to the session and redirect to work.aspx. With a
>new sqlstring I fetch the data from the sqlserver. But this data is
>only to display. The user can edit Data for a new record in anoter
>table and end it wiht button click. Here I will save all sessionvalues
>(username, and recordinformation) with sqlstring and redirect to
>search.aspx.
>Now the problems:
>1. I don't no what I've changed - but I have to...
>After redirection from work to search I've got an sql-error. The string
>will be cleard before building new, so why does it run once, but not
>after redirect?
>2. I solved this problem with redirecting from work to default. Its
>running. But: the session username is empty - why?
>3. I solved with writing the username in an hidden field on
>default.aspx, read it again and write to session. Everything is fine.
>4. Now we can work, and I will change the username from manuel login to
>reading from client windows. But I realy want to know why I have the
>Problems 1 to 3 and problem no 4 is: some stored records have no
>username within. Who can explain it to me - who as a solution to solve
>the problems?
Hi Allen,

it will be to much code but I think, it's better for understanding:

I start with the default.aspx. If the session is new, nothing will
happen unless the user logs in - no problem. When I come from my last
page (call.aspx) the sessionvariable 'user' has still a value. When I
redirect to my second page (suche.aspx) this value will be lost. So I
do this workaround:

default.aspx

Sub Page_Load (ByVal Sender As Object, _
ByVal E As EventArgs)

Session("KD_VNAME")=""
Session("KD_NAME")=""
Session("STADT")=""
Session("PLZ")=""
Session("STRASSE")=""

If Session.IsNewSession Then
TextBox1.value="neu"
else
if ispostback then
Session("Anwendername") = TextBoxLogin.value
TextBox1.value=Session("Anwendername")
response.redirect("suche.aspx")
else
TextBox1.value=Session("Anwendername")
Session("Anwendername") = TextBox1.value
response.redirect("suche.aspx")
end if
end if

When loading the suche.aspx I check on newsession and if not I will
clear the value of some session varialbes:

suche.aspx

Sub Page_Load (ByVal Sender As Object, _
ByVal E As EventArgs)

If Session.IsNewSession Then
response.redirect("default.aspx")
else
dataSet
end if
end sub

public sub DataSet()
Session("KD_VNAME")=""
Session("KD_NAME")=""
Session("STADT")=""
Session("PLZ")=""
Session("STRASSE")=""
Datagrid1.DataBind()
end sub

After the user filled in the search date the function will be called.
First I had a redirect form my last page (call.aspx) back to this one.
If I am first on the page everything is fine. The second time, after
redirect I get an error, which means the sql statement is incorrect.
But there can no old value - I clear it. So I redirect to the
default.aspx:

function DatenSuche() As System.Data.IDataReader
Dim connectionString As String = "Data Source=mssql;Initial
Catalog=DB;User Id=huser;Password=passw;Connect Timeout=15;Network
Library=dbmssocn;"
Dim dbConnection As System.Data.IDbConnection = New
System.Data.SqlClient.SqlConnection(connectionStri ng)
Dim queryString As String = ""
Dim dbCommand As System.Data.IDbCommand = New
System.Data.SqlClient.SqlCommand

if TextBox_Name.text <> "" then
if queryString <> "" then
queryString = querystring & " and "
end if
queryString = queryString & "[KD_NAME] like N'" & TextBox_Name.text
& "%' "
end if
if TextBox_Vorname.text <> "" then
if queryString <> "" then
queryString = querystring & " and "
end if
queryString = queryString & "[KD_VNAME] like N'" &
TextBox_Vorname.text & "%' "
end if

queryString = "SELECT [View_Such].* FROM [View_Such] WHERE (" &
queryString & ")"
dbCommand.CommandText = queryString
dbCommand.Connection = dbConnection
dbConnection.Open
Dim dataReader As System.Data.IDataReader =
dbCommand.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)
Return dataReader
dataReader.close
dbConnection.close
connectionString = ""
queryString = ""
end function

call.aspx

public sub ButtonEnde_Click(sender As Object, e As EventArgs)
response.redirect("default.aspx")
'response.redirect("suche.aspx")
end sub

Any idea?
One thing you may want to try is to use:

Response.Redirect("page", False);

Whenever you are in a page where the user might have started a
session. See:
http://weblogs.asp.net/bleroy/archi.../03/207486.aspx

Another approach I'd try is to not use so many redirects, but drop a
panel control on your form and keep the search results inside the
panel. You can set the Visible property of the panel to false, and
toggle the value to true when there are search results to display.
This might make the page easier to work with.

--
Scott
http://www.OdeToCode.com/blogs/scott/]

On 29 Jun 2005 04:04:53 -0700, "catweezle2010" <catweezle2010@.gmx.de>
wrote:

>Hi Allen,
>it will be to much code but I think, it's better for understanding:
>I start with the default.aspx. If the session is new, nothing will
>happen unless the user logs in - no problem. When I come from my last
>page (call.aspx) the sessionvariable 'user' has still a value. When I
>redirect to my second page (suche.aspx) this value will be lost. So I
>do this workaround:
>default.aspx
>Sub Page_Load (ByVal Sender As Object, _
> ByVal E As EventArgs)
> Session("KD_VNAME")=""
> Session("KD_NAME")=""
> Session("STADT")=""
> Session("PLZ")=""
> Session("STRASSE")=""
>If Session.IsNewSession Then
> TextBox1.value="neu"
> else
> if ispostback then
> Session("Anwendername") = TextBoxLogin.value
> TextBox1.value=Session("Anwendername")
> response.redirect("suche.aspx")
> else
> TextBox1.value=Session("Anwendername")
> Session("Anwendername") = TextBox1.value
> response.redirect("suche.aspx")
> end if
> end if
>When loading the suche.aspx I check on newsession and if not I will
>clear the value of some session varialbes:
>suche.aspx
>Sub Page_Load (ByVal Sender As Object, _
> ByVal E As EventArgs)
>If Session.IsNewSession Then
> response.redirect("default.aspx")
> else
> dataSet
> end if
>end sub
>public sub DataSet()
>Session("KD_VNAME")=""
> Session("KD_NAME")=""
> Session("STADT")=""
> Session("PLZ")=""
> Session("STRASSE")=""
> Datagrid1.DataBind()
>end sub
>
>After the user filled in the search date the function will be called.
>First I had a redirect form my last page (call.aspx) back to this one.
>If I am first on the page everything is fine. The second time, after
>redirect I get an error, which means the sql statement is incorrect.
>But there can no old value - I clear it. So I redirect to the
>default.aspx:
>function DatenSuche() As System.Data.IDataReader
> Dim connectionString As String = "Data Source=mssql;Initial
>Catalog=DB;User Id=huser;Password=passw;Connect Timeout=15;Network
>Library=dbmssocn;"
> Dim dbConnection As System.Data.IDbConnection = New
>System.Data.SqlClient.SqlConnection(connectionStri ng)
> Dim queryString As String = ""
> Dim dbCommand As System.Data.IDbCommand = New
>System.Data.SqlClient.SqlCommand
> if TextBox_Name.text <> "" then
>if queryString <> "" then
> queryString = querystring & " and "
> end if
> queryString = queryString & "[KD_NAME] like N'" & TextBox_Name.text
>& "%' "
> end if
> if TextBox_Vorname.text <> "" then
> if queryString <> "" then
> queryString = querystring & " and "
> end if
> queryString = queryString & "[KD_VNAME] like N'" &
>TextBox_Vorname.text & "%' "
> end if
>
> queryString = "SELECT [View_Such].* FROM [View_Such] WHERE (" &
>queryString & ")"
> dbCommand.CommandText = queryString
> dbCommand.Connection = dbConnection
> dbConnection.Open
> Dim dataReader As System.Data.IDataReader =
>dbCommand.ExecuteReader(System.Data.CommandBehavio r.CloseConnection)
> Return dataReader
> dataReader.close
> dbConnection.close
> connectionString = ""
> queryString = ""
>end function
>
>call.aspx
>public sub ButtonEnde_Click(sender As Object, e As EventArgs)
> response.redirect("default.aspx")
> 'response.redirect("suche.aspx")
> end sub
>
>
>Any idea?

session variable

Hi all
I'm newbie to asp.net and building simple pages using vb.net.
I have got three pages default.aspx (which is login page), index.aspx and logout.aspx.

In logout.aspx i have put following code...
Session.Clear()

Session.RemoveAll()

Session.Abandon()

Response.Redirect("default.aspx")

In Index.aspx I have following code in page load event..

If Session("login") = "" Then 'this session variable is created from default.aspx on successful login which store user login name

Response.Redirect("default.aspx")

End If

But somehow after hitting logout link from index.aspx it still keeps session("login") value though it redirect to default.aspx..

After tht if i try to execute page directly index.aspx (on same browser window), the page index.aspx is displayed..(which is basically should not be displayed.) ...When I hit refresh it redirects to default.aspx but url remains the same with index.aspx

Below is web.config snippet...

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/
Anyone has any clue why its happening like this??

Any help would be appreciated..

Thanx in advance

daveA couple comments. First off, you might save yourself a handful of lines of code as well as this problem if you used the built-in FormsAuthentication:
http://www.15seconds.com/issue/020220.htm
http://www.15seconds.com/issue/020305.htm

I suspect they are getting to index.aspx because the page is cached...hence when they force a refresh they are being logged out. You might want to look at :
http://www.15seconds.com/issue/010202.htm
which will tell you how to make sure the browser doesn't cache the page.

As for why ur session doesn't clear, you might wanna try Response.Redirect("default.aspx", false) If that works check out :
http://weblogs.asp.net/bleroy/archi.../03/207486.aspx for why...not sure if that applies to clearing session though, don't think so.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!)

"dave" <nojunk@.nojunk.com> wrote in message news:ONMZBDbvFHA.2072@.TK2MSFTNGP14.phx.gbl...
Hi all
I'm newbie to asp.net and building simple pages using vb.net.
I have got three pages default.aspx (which is login page), index.aspx and logout.aspx.

In logout.aspx i have put following code...
Session.Clear()

Session.RemoveAll()

Session.Abandon()

Response.Redirect("default.aspx")

In Index.aspx I have following code in page load event..

If Session("login") = "" Then 'this session variable is created from default.aspx on successful login which store user login name

Response.Redirect("default.aspx")

End If

But somehow after hitting logout link from index.aspx it still keeps session("login") value though it redirect to default.aspx..

After tht if i try to execute page directly index.aspx (on same browser window), the page index.aspx is displayed..(which is basically should not be displayed.) ...When I hit refresh it redirects to default.aspx but url remains the same with index.aspx

Below is web.config snippet...

<sessionState

mode="InProc"

stateConnectionString="tcpip=127.0.0.1:42424"

sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"

cookieless="false"

timeout="20"

/
Anyone has any clue why its happening like this??

Any help would be appreciated..

Thanx in advance

dave
"dave" <nojunk@.nojunk.com> wrote in message news:ONMZBDbvFHA.2072@.TK2MSFTNGP14.phx.gbl...
Hi all
I'm newbie to asp.net and building simple pages using vb.net.
I have got three pages default.aspx (which is login page), index.aspx and logout.aspx.

In logout.aspx i have put following code...
Session.Clear()

Session.RemoveAll()

Session.Abandon()

Response.Redirect("default.aspx")

In Index.aspx I have following code in page load event..

If Session("login") = "" Then 'this session variable is created from default.aspx on successful login which store user login name

Response.Redirect("default.aspx")

End If

In C# I would not check for an empty string, but for null. In VB you might need to
check for "Nothing".
You don't store "strings" in Session, you store "objects". A string is a perfectly
valid object, so you can store it without problems. But if the Session variable
has been removed, it's *removed* (not there, nothing), not an empty string.
But somehow after hitting logout link from index.aspx it still keeps session("login") value though it redirect to default.aspx..

After tht if i try to execute page directly index.aspx (on same browser window), the page index.aspx is displayed..(which is basically should not be displayed.) ...When I hit refresh it redirects to default.aspx but url remains the same with index.aspx

If you use Redirect, you instruct the browser to go to a different URL, so that other
URL should be displayed (If you had used Transfer, this would not be the case, as that
works entirely server-side). So you are not "redirected" to default.aspx, but something else
happened.

Hans Kesting

session variable

Hi all
I'm newbie to asp.net and building simple pages using vb.net.
I have got three pages default.aspx (which is login page), index.aspx and lo
gout.aspx.
In logout.aspx i have put following code...
Session.Clear()
Session.RemoveAll()
Session.Abandon()
Response.Redirect("default.aspx")
In Index.aspx I have following code in page load event..
If Session("login") = "" Then 'this session variable is created from default
.aspx on successful login which store user login name
Response.Redirect("default.aspx")
End If
But somehow after hitting logout link from index.aspx it still keeps session
("login") value though it redirect to default.aspx..
After tht if i try to execute page directly index.aspx (on same browser wind
ow), the page index.aspx is displayed..(which is basically should not be dis
played.) ...When I hit refresh it redirects to default.aspx but url remains
the same with index.aspx
Below is web.config snippet...
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
Anyone has any clue why its happening like this'
Any help would be appreciated..
Thanx in advance
daveA couple comments. First off, you might save yourself a handful of lines of
code as well as this problem if you used the built-in FormsAuthentication:
http://www.15seconds.com/issue/020220.htm
http://www.15seconds.com/issue/020305.htm
I suspect they are getting to index.aspx because the page is cached...hence
when they force a refresh they are being logged out. You might want to look
at :
http://www.15seconds.com/issue/010202.htm
which will tell you how to make sure the browser doesn't cache the page.
As for why ur session doesn't clear, you might wanna try Response.Redirect("
default.aspx", false) If that works check out :
http://weblogs.asp.net/bleroy/archi.../03/207486.aspx for why...not
sure if that applies to clearing session though, don't think so.
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to come!
)
"dave" <nojunk@.nojunk.com> wrote in message news:ONMZBDbvFHA.2072@.TK2MSFTNGP
14.phx.gbl...
Hi all
I'm newbie to asp.net and building simple pages using vb.net.
I have got three pages default.aspx (which is login page), index.aspx and lo
gout.aspx.
In logout.aspx i have put following code...
Session.Clear()
Session.RemoveAll()
Session.Abandon()
Response.Redirect("default.aspx")
In Index.aspx I have following code in page load event..
If Session("login") = "" Then 'this session variable is created from default
.aspx on successful login which store user login name
Response.Redirect("default.aspx")
End If
But somehow after hitting logout link from index.aspx it still keeps session
("login") value though it redirect to default.aspx..
After tht if i try to execute page directly index.aspx (on same browser wind
ow), the page index.aspx is displayed..(which is basically should not be dis
played.) ...When I hit refresh it redirects to default.aspx but url remains
the same with index.aspx
Below is web.config snippet...
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data source=127.0.0.1;Trusted_Connection=yes"
cookieless="false"
timeout="20"
/>
Anyone has any clue why its happening like this'
Any help would be appreciated..
Thanx in advance
dave
"dave" <nojunk@.nojunk.com> wrote in message news:ONMZBDbvFHA.2072@.TK2MSFTNGP
14.phx.gbl...
Hi all
I'm newbie to asp.net and building simple pages using vb.net.
I have got three pages default.aspx (which is login page), index.aspx and lo
gout.aspx.
In logout.aspx i have put following code...
Session.Clear()
Session.RemoveAll()
Session.Abandon()
Response.Redirect("default.aspx")
In Index.aspx I have following code in page load event..
If Session("login") = "" Then 'this session variable is created from default
.aspx on successful login which store user login name
Response.Redirect("default.aspx")
End If
In C# I would not check for an empty string, but for null. In VB you might n
eed to
check for "Nothing".
You don't store "strings" in Session, you store "objects". A string is a per
fectly
valid object, so you can store it without problems. But if the Session varia
ble
has been removed, it's *removed* (not there, nothing), not an empty string.
But somehow after hitting logout link from index.aspx it still keeps session
("login") value though it redirect to default.aspx..
After tht if i try to execute page directly index.aspx (on same browser wind
ow), the page index.aspx is displayed..(which is basically should not be dis
played.) ...When I hit refresh it redirects to default.aspx but url remains
the same with index.aspx
If you use Redirect, you instruct the browser to go to a different URL, so t
hat other
URL should be displayed (If you had used Transfer, this would not be the cas
e, as that
works entirely server-side). So you are not "redirected" to default.aspx, bu
t something else
happened.
Hans Kesting

Session Variable

I have an application where the default page requires the user to choose the location they are logging into. I take the value (one or two letter designation) and save it to a Session variable. I then access this variable on the page load of all pages in the application and use the value to call stored procedures to display the proper data from the database. The problem is, some users are timing out and lose their session causing them to have to go back to the first page and re-choose their location. I did increase the session timeout to 60 but this may still not be long enough for some users. Is there a better way to do this without using a session variable? Any help and/or example VB code will be appreciated.

Thanks

While navigating to other page assign this value to a hidden field. Then afterwards check the value of hidden field instead of Session variable. Once you are navigating to another page transfer this value in hidden field again to Session.

Let me know if you need any further help


Any session var or app var would be subject to a session timeout. You do not want to extend the timeout too much because it has an adverse effect in resource consumption.

If your security requirements are not too stringent (risk is low), you could use a QueryString (URL) parameter instead. Validate the parameter to make sure nothing fishy comes in before you use it. You could keep the info in a user database and get the data from there when the user first logs in.


Forgot: You could also use Hidden fields (if security is not stringent) or cokkies if accepted in your client browsers.

See:http://msdn2.microsoft.com/en-us/library/z1hkazw7.aspx


I tried the suggestion and am now running into a problem. It works great if the user stays on the same page. The problem is when the user clicks on another page using the link buttons I provide. If the session expires then my variables are not set. I was hoping to set the Session Variables again when the user leaves the page but I'm not sure where to do this. Any more ideas?

What I would recommend is that you use a cookie for your application with a time-out of however many minutes you think you need. Each page would then check the cookie to get the values needed. With those wonderful people, such as myself, that don't allow most cookies, you can always make the page auto-refresh every x number of minutes. That should reset the timer on the session variable. You will have the problem of needing to make sure that data is not resubmitted. Web applications have the drawback of not automatically trusting the user the way a desktop application would.

Monday, March 26, 2012

Session Variable Disappeared

Hello,

I'm using MasterPages to create the layout for all of the pages in my project. Before I converted the Default.aspx page over to the masterpage format this worked.

I have two pages, login.aspx and default.aspx, of course I'm using Forms Authentication. All that works fine, you try to get to default it prompts for login.

Well I used a custom function for the login, it compares data entered to that in a database, if it passed it also returns a variable containing there Trust Level. (String)

At the end of the Button Submit Click but before I redirect the authenticated user to the page they requested I use this code to store trust level in the Session object.

Session("Trust")=TRUST

When the default page loads it shows/hides elements base on thier trust. Now after I've switched over to master pages the code no longer works, it's returning an empty string for Session("Trust")

Example:

<% If Session("Trust") = "Admin" Then %>
Your Access Level is Administrator
<% Else %>
Your Access Level is <% Response.Write(Session("Trust")) %>
<% End If %
I'm loggin in with the Admin Account with a trust of "Admin" and it's just returning an empty string.

Any ideas?What are you using to redirect? If you are not currently, you should be using the RedirectFromLoginPage method.

HTH...
CHris
Thx for the reply,

I figured it out, it was because I deleted the Global.* file. D'OH