Click here to Skip to main content
15,888,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am using third party tool in my application and i want to transfer the DataTable from one Page to another through Session but the third tool clear all the session and cookies.

if there is any way to transfer the DataTable without storing in Session.
Posted
Comments
Member 10351875 27-Dec-14 9:26am    
you can use static variable but its not a good approach

you can use static variable but its not a good approach..or customize the third party control not to clear cookies and session or kindly paste the code
 
Share this answer
 
v2
Comments
Static variable should not be used in Web Applications, because they have application level scope, not session level. So, they will retain values across users.
ksmtariqzafar 27-Dec-14 9:40am    
But when multiple users use the application in one time to there is a problem if i am using static variable
also i can not customize the third party control to clear cookies and session.
I would advise you to store the DataTable records in a file or in a Table in Database. Then retrieve the data again in other page and reuse it.
 
Share this answer
 
Comments
ksmtariqzafar 27-Dec-14 9:47am    
If user not going to the other page then Database fill anonymously and also file.
Don't you need that data to be stored anywhere? Is it temporary only?
ksmtariqzafar 27-Dec-14 9:58am    
No if third party tool will authorize the user then save the first form data in database other wise if third party tool reject the user then no data will be saved.
Okay, you have the logic in place. So, if it authorized, the. Save, else don't. Then if you go to the next page, retrieve the data from that table, if the data is there, then show it. Simple.
ksmtariqzafar 27-Dec-14 10:08am    
if the user don't go to the next page to authenticate him/her self and will put the data multiple times to this data is useless. i need the user first to authenticate then save the data
 
Share this answer
 
The Third party app... deleting all the sessions and cookies

but I got the solution.

On First page C# Code:
DataSet dsinfo = new DataSet();
dsinfo.Tables.Add(dtInfo);
XmlDataDocument xmldatainfo = new XmlDataDocument(dsinfo);
XmlElement xmlElementinfo = xmldatainfo.DocumentElement;
string xml_stringinfo = xmldatainfo.OuterXml.ToString();
Session["dtInfo"] = xml_stringinfo;


On third Party page Passing Hidden input
Like this: under form tag
HTML
<input type="hidden" name="FeeDetailinfo" value="<%=Session["dtInfo"] %>" />


and one third page retrieve the input in c# code
Like this:
DataTable dtinfo = new DataTable();
DataSet dsinfo = new DataSet();
StringReader readerinfo = new StringReader(Request.Form["FeeDetailinfo"]);
dsinfo.ReadXml(readerinfo);
dtinfo = dsinfo.Tables[0];
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900