.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

Why do session variables disappear on redirect between pages in IFrame?

Posted By:      Posted Date: April 14, 2011    Points: 0   Category :ASP.Net

I have a web site A with IFrame linked to web site B. A and B are located on different servers. B site has several pages (BHome, B1, B2).
When B site redirects from BHome page to Bx all session variables get cleared.

I can’t find why all session variables disappear.

Do you have any ideas?

View Complete Post

More Related Resource Links

session variables and master pages

Hi all: I have a master page and 2 content pages. In the master page I use a session variable. As it, I suppose this session variable is read by the two content pages. But it isn't working. This session variable is read by the first content page and not the second. Why? Thanks in advance if you can help me      

Session variables value lost between pages



          I am using Session ID Manager in all the pages of the website, but I am losing session variables in between the pages. what should I do to save the values of session variables.

Thank you



Session and Application Variables


I have a web application in which i need to logout the user if he clicks the logout button or even if he closes his browser window. On Logout button click, i am doing session.Abandon(), but how to go about his browser window close.

Can anybody help with a code sample.

ASP.NET MVC 2 - I have a serious concern about the management of session variables.


I have a serious concern about the management of session variables.
I state that I have Windows Web Server 2008.
Currently values in the controller and call a session variable like this:
I have an action in as:
System.Web.HttpContext.Current.Session ['name'] = id_userlogged;

Defining session variables...



This is a pretty basic question.

I have some code where I need to define a session variable  however it's coming back as Nothing when the code is executed. Here's the code:

' Default Currency

REQCURR = Request.Querystring("p_DCURR")
'If not explicitly specified, try to get it from session

If (REQCURR = "") Then

     If (Session("REQCURR") <> "") Then
          REQCURR = Session("REQCURR")

          'Here is the session variable I'm trying to define:
          Session("REQCAD") = 0
          REQCURR = ""
     End If

End If


So, for some reason that Session("REQCAD") = 0 has no value instead of having a value of 0.

Any thoughts?


Need to access session variables in an ashx?

Dear All,In my project i need to set session in an ashx file and access that session in aspx.cs file. for this i am dooing the following things.In .ashx filepublic class Upload : IHttpHandler , System.Web.SessionState.IRequiresSessionState{    public void ProcessRequest(HttpContext context)    {            HttpPostedFile postedFile = context.Request.Files["Filedata"];            context.Session["img"] = postedFile.FileName;    }}After the file upload happand i wrote the code in .aspx.cs fileprotected void Button1_Click(object sender, EventArgs e)    {        Response.Write(Session["img"].ToString());    }this is working fine in IE but in Mozilla,Chrome,safari and Opera i got Session["img"] is null. Any help can be appreciatedThanks & Regards Basheer K M Cybrosys Technologies Pvt. Ltd. Calicut. http://www.cybrosys.com

Using Global.asax to Set Session Variables Pulled From SQLServer

I have a custom class that pulls user information from a SQL Server table. Now that I'm expanding the site from a single page to others. I want to shift the code to the Session_Start event so that the information is always loaded when the site is accessed. How do I call my custom code from global.asax since its script and not a class. 

how to redirect user to login page if session is null

i have 2 page,1.login.aspx ---  2.welcome.aspxin my login.aspx im storing username into sesssion as below:Session["usernm"] = txtUsername.Text;in my welcome.aspx  pagein page_load event if (Session["usernm"]==null)        {            Response.Redirect("Login.aspx");        }----- here if i manulally paste the url ( http://localhost:4125/Loginado/welcome.aspx) it should go to  login.aspx for user credentialsbut its going directly to welcome.aspx  page.

Asp.net Pages Getting session timeout

in my website there is a folder which requires authunteication/jobseekers/but after sometimes, the session("cid") is "", that means there is no value of candidate in the session("cid") field, but iam able to browse the jobseeker folderiam not using asp.net default authenticaiton method, iam manualy authenticating themnow my concern iswhen there is no value in session("cid") the user must be prompted to login againhow can that be doneif put a check in master page for session("cid")but i also have login.aspx in that jobseekers folderso do i need to have login.aspx page outside the jobseeker folder and shall i write session("cid") in master page

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>

Session state just got screwed up between pages

I had a website that was working fine for months and now an external consultant played with IIS 6 and now every once in a while when I open a new page, the session is gone (same browser, sometimes a new window, sometimes the same).   As far as I can see the timeout is correct when I ping the Session.Timeout on page load.   What could be causing this??

How to catch error in session variable in globals.asax(Application_Error) and redirect to same page

Hi, i have a login page where username got to enter his/her username or password. When you try to enter any scripting over there eg:'<asd>' it gives an error  'Server Error in '/' Application' 'A Potentially dangerous Request. Form value was detected from client' I don't want to redirect user to custom error page when such unpredictable error occurs. infact i got a label on the same page itself where error's are displayed. how can i display such errors on this very same label. can i do that using globals Application_Error ?. Session variable not working here. Please give me the exact steps for how i can catch and display the error which are not validated. waiting for reply thanks and regards, Learning Programmer

Session Variables and Session Timeouts

I added the following code to global.asax to load up several session variable when a session starts. I'm assuming that when a page goes to use the variable that I should be 1) checking at the page level that the value is valid not 0 when its not expected to be 0, not a zero-length string when its expected to have a length 2) have code at the page level that sets the values if the values have not been set as when the Session timeout, ideally putting the code in a class derived from Page and then deriving all of my pages from the new class so that the code does not have to be repeated in every page Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs) ' Code that runs when a new session is started 'Move code here that sets the User Session Variables, currently done in the code behind of DefaultDirectory and the Dashboard Masters Dim ExceptionMessage As New StringBuilder ExceptionMessage.Append("Site accessed using " + Request.Browser.Browser + " " + Request.Browser.MajorVersion.toString + "." + Request.Browser.MinorVersion.tostring) Dim NewException As New NotSupportedException(ExceptionMessage.ToString) Elmah.ErrorSignal.FromCurrentContext().Raise(NewException) Dim CurrentUser As New MercurySiteUser.SiteUser() Session("UserE

Sharing the session variables between two .net applications using SQL Server Mode?

Hi, I have two different IIS applications within the same domain(let us say www.mydomain.com) , both of these applications use the same database instance(same connectionstring), now what I want is that both of applications can see each sessions variables , can SQL Server session state mode helps in this case? Did someone try that before? Is there any other way to share the session variables? Please help.  

Losing Session after redirect.


Hello everyone.


I am having an issue with a piece of code. Everything else on the site works perfect except for this part.
Basically, there is a button on a page that says 'Download images', what this does is compress a list of files and then redirects the user to the .zip file.

EDIT: The problem I am having is as soon as the 'Download Images' button is clicked and they are prompted to download the file their session is lost. It does not matter if they download the file or not, as soon as the button is hit the file copy process takes at most 10 seconds and then the download box is shown.

Here is the code on the 'Download Images' button:


Dim bpoClass As New BpoClass


Response.Redirect("zipfiles/" & Request.QueryString("UniqueID") & ".zip")


Now, if I comment out the bpoclass.compresszipfile function, it works; the session is not lost. So it  might have something to do with the code inside the fu

Set session Timeout and Auto Redirect



I am creating web application. In that I want to set session timeout (not idle timeout). If a user logged in that time the session time will start and it automatically should detect session timeout the page should redirect to another page. How can I acheive this.

Session State throws error in ASP.NET Site Pages for SharePoint 2010 portal using Visual Studio 2010


I'm developing Visual Studio 2010 solution for site pages. I’ve created Site Pages in SharePoint 2010 and I’m trying to access Session variables in code behind in ASP.NET but it throws the following 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 set the page directive as enableSessionState=&quo

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