Ask a Question related to ASP.NET General, Design and Development.
-
Mark MacRae #1
Re: [SOLVED] Session loses all variables during Response.Redirect
Ok, don't ask me why, but this solved it:
Replace the line:
Directory.Move(tempEventDirName, createdEventDirName);
With:
Directory.CreateDirectory(createdEventDirName);
File.Copy(tempEventDirName + model.imagePath_NullableString,
createdEventDirName + "/" + model.imagePath_NullableString, true);
Directory.Delete(tempEventDirName, true);
Don't ask me why Directory.Move causes the Session to abandon itself, but a
breakpoint in Global.asax.cs in the Session_End event handler confirms that
an explicit call to end the Session is made somewhere in .NET's black box
during the Response.Redirect. By swapping the lines as above, the problem
is gone. I'm still baffled as to why. Again, I use Directory.Move in
several nearly identical situations and do not see this behaviour.
For the waste of the better part of my week, and the stress and frustration
associated with it, I've afixed a ".NET .SUCKS" poster in my cubicle. I
feel better already.
Thanks again to those who tried to help out.
mark
"Mark MacRae" <nospam@nospam.com> wrote in message
news:%23lrqqF6SDHA.1920@TK2MSFTNGP11.phx.gbl...a> I have searched the newsgroups for this and found a couple of similar
> situations, but none solved my problem.
>
> Basically the click of a button on one webform saves an entity then
> Response.Redirects back to a list page which lists all the entities in the
> database belonging to the user who is currently logged in.
>
> This works fine most of the time. Except when you use the option to uploadthe> new image as part of the entity. I'm not entirely sure that that is
> relevant though because I have stepped through the code in debug mode and
> the Session still contains 10 variables right up until end of the save
> button click event code which is the Response.Redirect
>
> When I reach the first line of the Page_Load event on the listing page,step> Session has lost all of it's variables. Poof! Gone! Why? Is there asame> in between that I don't know about?
>
> I have seen responses that mention that both ASPX pages must be in theis> project, well they are. And in fact, as I mentioned, the session does not
> lose the variables most times. Only when a new image is uploaded. BelowContext.Request.PhysicalApplicationPath> the chunk of code that is different in that case:
>
>
> if(model.imagePath_NullableString != null) {
> string tempEventDirName = (string)Context.Session["tempDir"];
>
> if(tempEventDirName != null && tempEventDirName != string.Empty &&
> tempEventDirName != "") {
>
> string createdEventDirName => + "/images/listing_files/" + model.pk;
>
> Directory.Move(tempEventDirName, createdEventDirName);
>
> }
>
> }
>
>
Mark MacRae Guest
-
After redirect back from 3rd party, session variables lost
Thank you in advance. My ASP page 1 redirect user to third party's website, after the process at third party is finished, in 3rd party's... -
SOLVED [PHP] SESSION variables losing data on WinXP?
In case anyone else runs into this problem, the way I solved it was by reinstalling php with the windows installer from php.net. I'm not exactly... -
Adding variables to response.redirect
I have a page that contains processed variables that I'd like to forward using the response.redirect method. However, because the response.redirect... -
Session loses all variables during Response.Redirect
Hi, Just a hint. If you change anything in the Bin directory of the application the application will be restart and all the session data will be... -
PLEASE - Session Variables OR Response.Write querystring to target frame?
Hi, I'm doing an asp.net app (first one) and NEED to use frames (so please don't tell me not to!). I'm loading a mainframe.htm with two aspx files... -
fadi #2
Re: [SOLVED] Session loses all variables during Response.Redirect
Can I sign that poster? I have had my share of frustration with .NET. As to
the FileSystemObject, looks like we both ran into problems associated with
it at same time, where in my case it kept files open even though I issued
the close command, and even performed dispose on it resulting in IIS being
locked.
You may want to upgrade to .NET 2003 since it is pretty much a 3GIG service
pack to .NET 2002. But it also comes with bugs just not as many.
fadi
"Mark MacRae" <nospam@nospam.com> wrote in message
news:OHONHgUUDHA.1324@TK2MSFTNGP11.phx.gbl...a> Ok, don't ask me why, but this solved it:
> Replace the line:
> Directory.Move(tempEventDirName, createdEventDirName);
> With:
> Directory.CreateDirectory(createdEventDirName);
> File.Copy(tempEventDirName + model.imagePath_NullableString,
> createdEventDirName + "/" + model.imagePath_NullableString, true);
> Directory.Delete(tempEventDirName, true);
>
> Don't ask me why Directory.Move causes the Session to abandon itself, butthat> breakpoint in Global.asax.cs in the Session_End event handler confirmsfrustration> an explicit call to end the Session is made somewhere in .NET's black box
> during the Response.Redirect. By swapping the lines as above, the problem
> is gone. I'm still baffled as to why. Again, I use Directory.Move in
> several nearly identical situations and do not see this behaviour.
>
> For the waste of the better part of my week, and the stress andthe> associated with it, I've afixed a ".NET .SUCKS" poster in my cubicle. I
> feel better already.
> Thanks again to those who tried to help out.
> mark
>
>
> "Mark MacRae" <nospam@nospam.com> wrote in message
> news:%23lrqqF6SDHA.1920@TK2MSFTNGP11.phx.gbl...> > I have searched the newsgroups for this and found a couple of similar
> > situations, but none solved my problem.
> >
> > Basically the click of a button on one webform saves an entity then
> > Response.Redirects back to a list page which lists all the entities inupload> > database belonging to the user who is currently logged in.
> >
> > This works fine most of the time. Except when you use the option toand> a> > new image as part of the entity. I'm not entirely sure that that is
> > relevant though because I have stepped through the code in debug modenot> the> > the Session still contains 10 variables right up until end of the save
> > button click event code which is the Response.Redirect
> >
> > When I reach the first line of the Page_Load event on the listing page,> step> > Session has lost all of it's variables. Poof! Gone! Why? Is there a> same> > in between that I don't know about?
> >
> > I have seen responses that mention that both ASPX pages must be in the> > project, well they are. And in fact, as I mentioned, the session doesBelow> > lose the variables most times. Only when a new image is uploaded.> is> Context.Request.PhysicalApplicationPath> > the chunk of code that is different in that case:
> >
> >
> > if(model.imagePath_NullableString != null) {
> > string tempEventDirName = (string)Context.Session["tempDir"];
> >
> > if(tempEventDirName != null && tempEventDirName != string.Empty &&
> > tempEventDirName != "") {
> >
> > string createdEventDirName =>> > + "/images/listing_files/" + model.pk;
> >
> > Directory.Move(tempEventDirName, createdEventDirName);
> >
> > }
> >
> > }
> >
> >
>
fadi Guest
-
Unregistered #3
Re: [SOLVED] Session loses all variables during Response.Redirect
Ok, same problem here with directory.Delete and session , but, what is the solution ?
Regards
EdgarUnregistered Guest



Reply With Quote

