.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Session Problem with IE 6 and IFrames

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net

hi folks

i've a problem with session objects in my asp .net 2.0 webapplication. when i open my webapplication in a IFRAME and IE, it doesn't work, because my session object is NOTHING.

what's wrong ? what can i do ?

Kind regards

View Complete Post

More Related Resource Links

SQL Server Session state problem.


Hi to all,

I have some things that I want to know. I am right now using a free asp.net webhosting ("somee.com"). The problem is that when I am visiting a page, there's a tendency that values stored in my session variables are lost. Therefore, it causes an error when the requested page is loaded.

1. I am thinking of using sessionState mode="SqlServer". Will it solve my problem?

Actualy Im working on it but Im having problems when connecting to the sql database.

2.  Is that a problem in the webhost?

3. Do free webhosting sites provide allow session state in the sql server?. Because ive tried it locally into my computer and error say's i should intall the ASP.NET Session State SQL Server version 2.0 or above.

Session problem with display of image in row of reportviewer


Hello techies...

I am new to this sql reporting service. But anyhow by surfing I am able to bind the report but i was stuck in image display.

Anyways, i also managed that. But the real problem is whenever i was keeping a image control in rdlc report i was having session prob. If i remove the image control then as usual report works fine.

Please suggest me some solution.... either for session problem or for image display. I am keeping the image name in database but for binding the rdlc report i am using a store procedure which return the path (static) concating with the image name(kept in database).

Hope to find a solution .....

Problem with Session and PageMethod


Hi All,

I'm trying to show some data in the update panel refreshing every second using page method. Everything works fine until I introduce Session. As soon as I save some data into the session my Ajax Page method is not called every second. Here is the complete code


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="Test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script type="text/javascript" language="JavaScript">
        function UpdateStatus() {
            setTimeout("UpdateStatus()", 1000);

        function ShowStatus(sCurrentStatus) {
            document.getElementById('lblStatus').innerHTML = sCurrentStatus;
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="True&q

Session State Problem




I just for the first time into a session state problem. So I am hoping someone

here has the answer.


I have written an ASP.Net website and tried to implement the common poor mans online user count.
The problem I am having is the following.

On App_Start I create a variable and assign it the value of 0;

Then increase the number on session_start and decrement on session_end.

On my local IIS it works perfectly from IE8 and Opera. The value increments correctly.
As soon as I upload to my live server. The value increments on every link I click and every page refresh when I test with IE8.
This does not happen when testing with Opera.

Could someone please shed some light on the subject.




Louis Lews

session lost problem


hi there,

i have an application that uses sessions.

i have set at the web.config: 

<forms loginUrl="Default.aspx" protection="All" timeout="30" name=".ASPXFAUTH" path="/" requireSSL="false" slidingExpiration="true" defaultUrl="Default.aspx" cookieless="UseCookies" enableCrossAppRedirects="true"/>

and at the global.asax.vb

Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)
        Session.Timeout = 30

end Sub

and at default.aspx.vb

Protected Sub LoginButton_Click(ByVal sender As Object, ByVal e As EventArgs)
        Session("userName") = Login1.UserName
        Session.Timeout = 30 ' minutes of session '

    End Sub

At a local iis on windows xp works fine,

but when i publish it at the webserver i am redirected to the default page after about 30 sec!!!

any ideas?


Ajax Session timeout problem

Hi,  I have some problems when using AJAX with updatepanels. I have an ASP.NET webapplication with a login that uses form authentication with the timeout set to 5 min. After 5 min of idle the site should be redirected to the login.aspx page. My problem is that after using the site for 5 minutes when clicking on contents inside an updatepanel I get a messagebox with the following error: A Runtime Error has occurred.Do you wish to Debug? Line: 4723Error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 12031  I think that it has something to do with the ajax updatepanel since when I remove the updatpanels this problem does not appear. Instead the site is redirected to login.aspx as expected. When searching on the problem on google I see alot of people having similar problem, but I haven't found suitable solution. Any suggestions?

problem in join two pages with session

hi every body I have two web pages one for inbox messages and second for details for one message in first page I have gridview include name the sender , address the message and details message alongside with buttonfield to go  to another page to view  full message the code of gridview<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id" DataSourceID="SqlDataSource1" Width="648px" onrowcommand="GridView1_RowCommand"> <Columns> <asp:BoundField DataField="sender" HeaderText="sender" SortExpression="sender" /> <asp:BoundField DataField="address" HeaderText="address" SortExpression="address" /> <asp:BoundField DataField="details" HeaderText="details" SortExpression="details" /> <asp:ButtonField Text="More..." CommandName="Show_More" /> <asp:TemplateField ShowHeader="False"> <ItemTemplate> </ItemTemplate>

Weird problem with session cookie

Hi all,I'm having a weird problem with my web application, and I can't find the solution to it.I'm using a Java applet to read some data from an electronic ID. This applet posts its captured data to a HttpHandler class and stores the data back in some session variables. It all works smoothly, unless in some cases.Every time a do a new publish to the webserver or the website isn't touched for some time. There is a problem with the session.The applet can't find a session cookie, and so it crashes.I did some tests and indeed, the cookie ("ASP.NET_SessionId") does not exists. But it seems that other session variables (user login, etc) are working fine.To make sure that the cookie for the session ID is readable from the applet I do the following in the global.asax: Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started Dim isSessionFound As Boolean = False If Response.Cookies.Count > 0 Then For Each s As String In Response.Cookies.AllKeys If s = "ASP.NET_SessionId" Then Response.Cookies("ASP.NET_SessionId").HttpOnly = False isSessionFound = True 'just for test End If Next End If End SubI tried to do something with the isSessionFound, wh

AutoCompleteExtender ContextKey with Session Problem

I have a aspx page with an AutoCompleteExtender and I retrieve users from database.While user log in, I get user's id from database and set to Session["iduser"]. I want to use Session["iduser"] as a contextkey in AutoCompleteExtender. I tried different ways for this but it didn't work...Also I am using a updatepanel.<asp:ScriptManager ID="ScriptManager1" runat="server">    <Services>     <asp:ServiceReference Path="WebService.asmx" />    </Services>    </asp:ScriptManager>my source code:<asp:TextBox ID="txtPost" runat="server"  CssClass="form_text_ozellik"         BackColor="Transparent" BorderStyle="None"></asp:TextBox>     <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtPost" ServicePath="WebService.asmx" ServiceMethod="GetUsers"   MinimumPrefixLength="1" CompletionSetCount="12"  DelimiterCharacters="," UseContextKey="true" CompletionInterval="200" EnableCaching="true">    </cc1:AutoCompleteExtender>my web service code:[We

Problem in display Full Name after logged in (Session Problem)


After login, i have create a session to display the Username of the logged user, however instead of display the Username, i want to display the Full_Name of the logged user

However i have no idea how it dones....Kindly if you could help me in giving suggestion / ideas. Thank you.

PersonUser Table

P_ID (PK)   =1

Username =lucy88

Password =88ycul

Full_Name = Lucy

User_Type =Admin

Login.aspx - as i do session, it will display lucy88 however i would like to display Full_Name which is Lucy.


    protected void Button1_Click(object sender, EventArgs e)
        SqlDataSource sds = new SqlDataSource();
        sds.ConnectionString = ConfigurationManager.ConnectionStrings["MyDB"].ToString();
        sds.SelectParameters.Add("Username", TypeCode.String, this.TextBox1.Text);
        sds.SelectParameters.Add("Password", TypeCode.String, this.TextBox2.Text);

        sds.SelectCommand = " SELECT * FROM [PersonUser] WHERE [Username] = @Username AND [Password] = @Password";
        DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);

        if (dv.Count

session timed out problem


i am create a web site using frame and child frmae.

when the session timed out login page opend in child frame .

but i require login page open alone not in child frame but id do

session problem


I have written a module that does the redirect on the bases of a lokup table, not getting any error but its not creating the session variable therefore its not doing redirects... Below is my code if any one can help...

Imports Microsoft.VisualBasic
Imports System.Web
Imports System.Data
Imports System.Data.SqlClient
Imports System.Web.HttpContext

Public Class URLRedirect
    Implements IHttpModule

    Public Sub New()
    End Sub

    Public ReadOnly Property ModuleName() As String
            Return "URLRedirect"
        End Get
    End Property

    ' In the Init function, register for HttpApplication 
    ' events by adding your handlers. 
    Public Sub Init(ByVal application As HttpApplication) Implements IHttpModule.Init
        AddHandler application.BeginRequest, AddressOf Me.Application_BeginRequest
        AddHandler application.EndRequest, AddressOf Me.Application_EndRequest
    End Sub

    Private Sub Application_BeginRequest(ByVal source As Object, ByVal e As EventArgs)
        ' Create HttpApplication and HttpContext objects to access 
        ' request and response properties. 
        Dim application As HttpApplication = DirectCast(source, HttpApplication)
        Dim context As HttpContext = application.Context
        Dim filePath As String = context.Request.FilePat

Session out problem


Hi Everyone,

I have a an application with session out problem. The problem is when i log in then session dont create but when we try again to login session create.

Means when i try two times then session is created.

Plz help me.

Problem with session... I think?


I have added url rewrite to my site and when i'm runnuing the site local i get this error

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the <configuration>\<system.web>\<httpModules> section in the application configuration. I have never seen this before and I have no idea of what I have done wrong. I hope you can help me

My Web.Config looks like this

<pages enableSessionState="true" />
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
      <add type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" name="UrlRewriter" />
      <add name="Session" type="System.Web.SessionState.SessionStateModule" />
    <sessionState mode="InProc" timeout="30" />


Session Ending or FormsAuthentication problem after the browser tab closing


In my project user logs in the site with login.aspx page. Then user is redirecting to homepage (anasayfa.aspx)

User close the browser tab (not the browser) then user tries to open the site again and the page is default.aspx

Default.aspx is useless in my project. Host area needs a default.aspx, index.html like something and I added this default aspx.

I want:

After user close the browser tab, if he/she wants to open the site again, the first page must be his/her homepage not default.aspx

I didn't use asp.net membership provider or anything like that.

This is my login.aspx page code:

protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        SqlConnection con = new SqlConnection();
        con.ConnectionString = cnnstr;
        SqlCommand cmd = con.CreateCommand();
        cmd.CommandText = "Select Roles,UserId,UserName,Sifre,AccountType From ProfilBilgileri Where UserName = @txtLoginUserName AND Sifre = @txtLoginSifre and Durum=1";
        cmd.Parameters.Add("@txtLoginUserName", SqlDbType.NVarCh

problem while Adding a value from a gridview to session!!!!!!!!!


Hi guyzzz,

We are developing a website in which we have a gridview where we have added a hyperlink field to navigate to another web form. Here we have to enter a particular value from the gridview to session in order to display it in another web form as a label.

As we are bit new using .Net, could any of you guys please help us in finding a solution.


Thanks and Regards,



ASP.Net 4 Problem with Session - System.Web.SessionState.HttpSessionState


I am building the Tailspin Shopping Cart from the asp.net http://www.asp.net/web-forms 

I am trying to put in this code into a Class

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using uboPrducts.Data_Access;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;

namespace uboPrducts.Classes
    public struct ShoppingCartUpdates
        public int ProductId;
        public int PurchaseQantity;
        public bool RemoveItem;

    public partial class MyShoppingCart
        public const string CartId = "TailSpinSpyWorks_CartID";

        public String GetShoppingCartId()
            if (Session[CartId] == null)
                Session[CartId] = System.Web.HttpContext.Current.Request.IsAuthenticated ? User.Identity.Name : Guid.NewGuid().ToString();
            return Session[CartId].ToString();

I get 4 errors from the above few lines. It says that Session is "The name Session does not exist in the current context"

When I go to the downloaded program and open it (note I

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend