C# - Session Lost And Application End, After File Download?

Mar 18, 2010

I have this code in the end of link button click:

Response.ContentType = "application/zip";
Response.AppendHeader("content-disposition", "attachment; filename=download.zip");
Response.TransmitFile(Server.MapPath("download.zip"));
Response.End();
Response.Flush();

to download a zip file from an aspx page.In the previous page i set a session variable, after going to this download page and download the file, then press back i find the session=null "this happen after downloading more than 1 time", and the application_end in global.ascx called. Do you know why this may happen??Note: this is happening on all browsers, on IIS7 both local and on my server.

View 2 Replies


Similar Messages:

Jquery - Session Values Lost In An Application?

Mar 10, 2011

I created HttpHandler class in ASP.NET and configured a website to handle any request with the *.test path.

public class GameHandler : IHttpHandler, IRequiresSessionState
{
public bool IsReusable
{
get
{
return false;

[Code]....

I suspect the problem is that ASP.NET doesn't know these requests sent from javascript belong to the same session and that's why the Session values are lost.

View 1 Replies

Session Lost When Opening IE Window From Application Hosted In Outlook?

Apr 28, 2010

An ASP.NET application (actually with Silverlight but it doesn't matter) is hosted in Outlook as folder home page. In this application there's a link to open popup window, which opens a separate IE window, not in Outlook.

The problem is that in this case it seems that ASP.NET session is lost. A call to ASP.NET service has nothing in Session and Session._id is different. I suspect that Outlook has different cookies than IE.

How do I preserve session when opening IE popup from Outlook? Maybe pass session id via URL somehow, or configure this in web.config?

View 2 Replies

State Management :: Session Gets Lost When Set Session Response.cookie

Jan 25, 2011

I need to make my asp.net session cookie as secure but whenever i check user authentication and after that i am trying to set cookie to true then my session lost my user information and so it always redirect login page. I am settings user to HttpContext.Current.Session["user"] and check every time, is user is valid and if valid then move ahead. but before that i make my asp.net session cookie as true.

[Code]....

but after that i observe that somehow "Session_Start" event gets called.

View 1 Replies

Mobiles :: How To Upload And Download File In .net Mobile Application

Jan 28, 2010

i m using asp.net fileUploader controle to upload file in mobile application but file is not uploading.

View 1 Replies

C# - End User To Use My Silverlight Media Player Application In Browser To Play The File, Prevent Them From Download To Local Directly?

Mar 4, 2010

I am using VSTS 2008 + C# + .Net 3.5 + Silverlight 3.0 + ASP.Net to develop a Silverlight application (a video media player) in browser and the function is simple, just use MediaElement to play a remote video file.The remote server is Windows Server 2008 + IIS 7.0 + IIS Media Bit Rate Throttling Control.Since the request media URL can be discovered (e.g. from traffic sniffer), and I want to know how to prevent from download directly from the Url? i.e. I want end user to use my Silverlight media player application in browser to play the file, prevent them from download to local directly. Any easy and quick solution or reference code/documents?

View 5 Replies

Session Value Lost In C#?

Apr 9, 2010

Am doing wepsite for show images from local drive using asp.net.am using session object for Transfer image path from first page to second page its running nice in vs 2003 .but i converted this website to vs 2005.but session value does't pass to next page.i got null value in session object. am using inproc session mode

View 3 Replies

Session Variable Getting Lost?

Sep 22, 2010

Given this Global.asax.cs:

using System;
using System.Web;

namespace Foo.Web {
[code]....

User hits webapp and is shown Introduction.aspx

User continues using webapp for a few minutes (ASP.NET_SessionId: ublbhu45ji31e055ywqu0555)

User falls idle (doesn't perform any postbacks) for a few minutes

User performs postback

User is shown Introduction.aspx
Second inspection of user's ASP.NET_SessionId cookie still shows ublbhu45ji31e055ywqu0555

Why is the user shown Introduction.apsx the second time inside the same ASP.NET Session? I'm familiar w/ the risk in setting session variables just before a redirect in the same postback, but that doesn't apply here, right?

View 1 Replies

Asp - Lost Session When AddModelError

Apr 6, 2010

I do not know why, but every time I add a ModelErrror my session is lost. Someone tell me how I can work around / fix it?

Session[CtSessionName + SessionId] = _ListaAcaoMenuInfo;
AcaoMenuInfoExt _SelecionadoAcaoMenuExt = _ListaAcaoMenuInfo.Where(p => p.Id_acao == id).FirstOrDefault();
if (_SelecionadoAcaoMenuExt.Is_AcaoInicial)
{
ModelState.AddModelError(String.Empty, "Error! Try Again, and Again, And Again!");
}

View 1 Replies

MVC :: Session Lost While Redirecting

Nov 25, 2010

I have two sites desigined on ASP.net MVC 2 pattern. I want to redirect from one site to another with the help of Redirect(url) action result. My problem is that I am able to redirect to other site but my session gets lost. Is there any way by which I can retain the session value? My constraints are I cannot use the sql membership provider, cookies and querystrings

View 19 Replies

Show Download Dialog Box In Case Of File Download - Located On Amazon Server

Jan 4, 2010

i am using amazon s3 service. now i want to show download dialog box in my asp.net application when user come on download page. i am using amazon sdk.

View 1 Replies

HttpHandlers / Modules :: Redirect Shareware Download URL From A File To A Download Page?

Oct 13, 2010

I'm about to submit my pad file to multiple sharware sites but the pad file has to have a direct link to the download file and can't link to a download page which is what I would like to do, so I can track the traffic and get the downloader's email before allowing the download. I am running an ASP.NET site in VB. Is there a way to tell the web app to redirect to a specific aspx page when it receives a request for a specific file?

View 1 Replies

AJAX :: Download LinkButton In UpdatePanel Throwing Error While File Download?

Jun 10, 2013

I have added linkbutton inside gridview to download, below is my code..

protected void lnkDownload_Click(object sender, EventArgs e)
{
try
{

[Code].....

its giving me following error

"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack"

View 1 Replies

Web Forms :: Download File Using New Window When Download Button Is Clicked

Sep 2, 2013

I need to download  a .mp3 file from a folder. during download a new blank page should open and after downloading it should close automatically.

View 1 Replies

Session Variable Lost In IFrame

Dec 13, 2010

I have session variable that is created in EditPlaylist.aspx. Edit.aspx is loading EditPlaylist.aspx in an iframe. when loading sessions from EditPlaylist.aspx page they are null. the session was not before I added the EditPlaylist.aspx to an iFrame. Is there a workaround for this?

View 1 Replies

MVC :: Session Variable Lost When Using Hostname In Url (IE)?

Nov 29, 2010

I'm learning asp.net mvc 2, it's very excting with me.

I has built a small MVC2 application, it is working fine in built it ASP.net Development Server. However, there're something wrong when have it deployed in IIS 7.5, Window Server 2008 R2 Enterprise. Session is awlays null when I access the application by IE and use hostname to specify the url.

Using IE (IE 7 or IE8) to access my application with link [URL] every working fine

But when I use IE (IE 7 or IE8) to access my application with link [URL] session always null

I'm supprised while FireFox working fine in all cases, both of built in ASP.net Development Server and IIS server, both cases hostname and ip and localhost.

View 4 Replies

How To Prevent Session Variables Getting Lost

May 7, 2015

i'm using session variables for send variables between aspx page and it works fine ...but after some time of inctivity(user) in the page the sessions is los...how can i resolve this issue ? this is my code below how to send session :

protected void Lst_Interv(object sender, EventArgs e)
{
Session["Id"] = gdMedical.SelectedRow.Cells[0].Text.Trim();
Session["Service"] = gdMedical.SelectedRow.Cells[6].Text.Trim();
Session["Nom"] = gdMedical.SelectedRow.Cells[2].Text.Trim();
string pageurl = "LstIntervention.aspx";
Response.Write("<script> window.open('" + pageurl + "','_blank'); </script>");
}

View 1 Replies

Session Variables Get Lost On Browser Close

May 18, 2010

I'm creating a site. Below is my authentication tag and session tag in web.config

<authentication mode="Forms">
<forms protection="All" loginUrl="Pages/Log In/Login.aspx" name=".ASPXFORMSAUTH" cookieless="UseCookies" requireSSL="false"
defaultUrl="Pages/Common/Default.aspx" enableCrossAppRedirects="false" slidingExpiration="true" timeout="30"path="/">
</forms>
</authentication>
<sessionState mode="InProc" timeout="30" cookieless="false" cookieName=".ASPSession"/>
And I have a custom Membership Providor....
<membership defaultProvider="SqlMemberShipProvider" userIsOnlineTimeWindow="15" hashAlgorithmType="">
<providers>
<clear/>
<add
name="SqlMemberShipProvider"
type="RoalManagement.SqlMemberShipProvider"
connectionStringName="SqlServices"
enablePasswordRetrieval="true"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
writeExceptionsToEventLog="true"
applicationName="OnlineOnTheWeb"
minRequiredPasswordLength="6"
passwordStrengthRegularExpression="^.*(?=.{6,50})(?=.*[a-z])(?=.*[A-Z])(?=.*[dW]).*$"
maxInvalidPasswordAttempts="3"
requiresUniqueEmail="true"
/>
</providers>
</membership>

Now in login page after firsttime login i set some session data... like
protected void Login_LoggedIn(object sender, EventArgs e)
{
//.....
Session["EMPLOYEELOGGEDIN"] = "Y";
//.....
}

Now say i close the browser... and next time when i open the site it takes me directly to the default page [Login_LoggedIn is not called accordingly]... because i'm already logged in for 30 mins acc. to configuration. but as my session id gets changed i can't access Session["EMPLOYEELOGGEDIN"] from any page in this time. It always returns null. But how do i get back the previous session for that person?

View 7 Replies

Session Variables Lost On Postback Using AJAX?

Jun 7, 2010

I'm evaluating using Ajax in a new project and so I've developed a simple web page to test a few things, however even the simplest task seems to cause my session to be cleared. I am using VS2008 with .Net 3.5 SP1 and the page is in my existing solution which has several custom handlers and modules in the web.config. Below is the code I'm using, it's a simple test which puts a variable into the session then on the buttons postback tries to get the same variable, however it always fails as the session is blank.

The Default.aspx code snippet
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" /> [code]....

View 1 Replies

Session State Lost Between Ajax Posts?

Jul 16, 2010

I have an asp.net login page, which when initialized sets some session variables. When the user clicks login, an AJAX request is made which validates the user and sets additional session variables and returns a result to the client. The client is then redirected based on the login result. In the redirected page, I can access the session variables set when the login page was initialized (i.e. before the login) but none are present for those set during the login validation (part of an ajax call).

is this expected behaviour? Why would an ajax call generate a new session and thus cause the data to be lost?

View 3 Replies

Session Variable Getting Lost Using Firefox - Works In IE?

Apr 29, 2010

I am setting a Session variable in an HttpHandler, and then getting its value in the Page_load event of an ASPX page. I'm setting it using

public void ProcessRequest(HttpContext context)
{
HttpPostedFile file = context.Request.Files["Filedata"];
context.Session["WorkingImage"] = file.FileName;
}

(And before someone suggests that I check the validity of file.FileName, this same problem occurs if I hard-code a test string in there.) It's working just fine in IE, but in Firefox the Session Variable is not found, getting the "Object reference not set to an instance of an object" error in the following code:

protected void Page_Load(object sender, EventArgs e)
{
string loc = Session["WorkingImage"].ToString();
}

Has anyone encountered this problem - and hopefully come up with a means for passing the session variable?

View 1 Replies

IIS7 ASP.NET In-proc Session NOT Being Lost After App Recycle?

Aug 23, 2010

I've got an ASP.NET MVC app running under IIS7. It's using the default in-proc session management, which, according to all that I read, should lose the users' session after an app pool recycle.It doesn't seem to be losing it though. Even an IIS reset doesn't lose the session.Has something changed in IIS7 that keeps the session alive?

View 1 Replies

Web Forms :: Session Variables Value Lost On Page Refresh?

Jul 27, 2010

I am developing an application using Visual Studio 2010 and SQLServer 2008. My application has two pages and the first page contains a GridView with all the records "User Administration" and when user click on any Username (template field ->linkbutton) I read the USERID like this.

Session["UserID"] = e.commandArgument;
Response.Redirect("UserOperations.aspx");

which takes it to the Data Entry page where user updates the information and save the data.

The problem i am facing is that when I hit the browser REFRESH button couple of times the session variables looses the value which is trouble for me as I am using Session Variables for different purposes.

View 10 Replies

Internet Explorer - Session Cookie Lost Or Deleted

Feb 5, 2010

I have an ASP.NET 2.0 site that stores a user's ID in session to indicate that they are logged in. In some situations, the user doesn't appear to stay logged in. I've been monitoring traffic in Fiddler, and some details I've found: The problem is 100% repeatable on an older laptop of mine when running IE7 and the project manager's laptop when running IE7. The problem does not ever occur on my current laptop running IE7, or any of these laptops when running FF. The problem occurs only in production--not on development, internal staging, or client staging. Production is the only load balanced environment, but the repeatability noted above makes me question load balancing as a factor.

When the page which sets Session("ID") = 1 sends a response back to the client, I can see a "Set-Cookie" header in all cases, which is creating the ASP.Net_Session_Id cookie (and it's HttpOnly). Subsequent requests to the server will send that cookie in the header on machines which are not exhibiting the problem, but not on machines that are, so either the cookie is getting deleted or the "Set-Cookie" header is being ignored.

The way logging in works is as follows: a page on [URL] has an iframe. The source of that iframe is a page on [URL]. A variety of pages served from [URL] take the user through the login/register process. The final step of [URL] is to redirect to a page back on [URL], including the user's ID in the querystring. This page on [URL] typically stores the ID in session, and then runs some JS to redirect the top level document to a new page, thus taking the user out of the iframe. This is a process that has worked for several years, with several values of [URL]. The one thing that may be different here is that in this case, the JS is simply destroying the iframe and some containing div's.

Another difference I see between scenarios where the problem occurs and where it doesn't is in the Google Analytics cookies. There is a difference when [URL] does its redirect to [URL] inside the iframe. When the problem does not occur, the request for SaveTheID.aspx includes a variety of Google Analytics cookies (__utma, __utmz, etc). When the problem does occur, this request does not include all the GA cookies (it's missing __utma, __utmz and __utmb). Production is the only environment where [URL] runs under SSL, so I thought that may be related. But we temporarily set up our staging copy of [URL] to use SSL, and that had no effect.

View 3 Replies

State Management :: Session Variables Value Lost Between Pages?

Nov 23, 2010

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.
Anoop

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved