|
Forums » .NET » ASP.Net MVC »
|
Calling asp.net mvc action method using jquery post method expires the session |
Posted Date: 09 Apr 2010 Posted By:: Randhir Yadav Member Level: Silver Member Rank: 1293 Points: 1
Responses:
4
|
hi,
i have a website where i provicde a link. On clicking the link a controller action method is called to generate a zip file after creation of zip file is done, i show the link to download the zip file by replacing the link to create a zip with the link to download the zip.
the problem is that after zip file creation is over and link is shown, when user clicks on the link to download the zip file, they are sent to login. After providing correct credentials in the login page they are prompted to download the zip file. they sould not be sent to the login page. In the action to generate zip file i haven't abondoned the session or haven't not done anything that abondons the session.
the user should not be sen't to login page after successful creation of zip file user should be able to download the file without login.
i search internet on this problem, but i did not find any solution. In one of the blog written by hanselman i found this statement that creates the problem with the session: Is some other thing like an Ajax call or IE's Content Advisor simultaneously hitting the default page or login page and causing a race condition that calls Session.Abandon? (It's happened before!)
so i thought there might be some problem with ajax call that causes the session to expire, but i don't know what is happening?
any help
please
thanks
|
Responses
|
#492057 Author: Harikrishna Member Level: Gold Member Rank: 393 Date: 09/Apr/2010 Rating: Points: 1 | i think in the page load, you are checking the session variable is null or not check ur session state......
Regards, Krishna
| #492102 Author: YuDi Member Level: Gold Member Rank: 115 Date: 09/Apr/2010 Rating: Points: 1 | hi use the following code on page load event
if(session["Uid"]!=null) { //redirect the download page }
“Talent wins games, but teamwork and intelligence wins championships.” umardaraj07@gmail.com
| #492164 Author: Randhir Yadav Member Level: Silver Member Rank: 1293 Date: 09/Apr/2010 Rating:  Points: 2 | HariKrishna and Umar, acutally the problem is not what you have answered about, it's like this after users click on the link to create zip file the zip file is created successfully but the session gets expired. this is not what i want.
Why does the session has to get expired after making a jquery post call to controller action to create a zip file?
i hope u understand the problem.
| #492338 Author: Randhir Yadav Member Level: Silver Member Rank: 1293 Date: 11/Apr/2010 Rating:  Points: 2 | hi, guys i found the solution to this problem. The problem was like this: I created a zip file in application folder and in .net 2.0 it is a rule that any change to the application files and folder causes the session to expire. As soon i created the zip file in the directory somewhere other than directory in application folder, everything worked fine.
anyways thanks
|
|
| Post Reply |
|
|
|
 | | This thread is locked for new responses. Please post your comments and questions as a separate thread. If required, refer to the URL of this page in your new post. |
|
|
|
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|