.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

Send object from one page to another

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net


I want to create object in 1.aspx, and then send it to 2.aspx. This methods are bad, because:

1)Send object with url, like this:


This is not confidential.


Session["field1"] = "12345"; // set
Object foo = Session["field1"]; // get

This is bad too, because in 2.aspx this fields send to textboxes, and if user go to 2.aspx without 1.aspx, he'll see old data. 

View Complete Post

More Related Resource Links

send data in class object from one page to another using session


hello everybody

now i hav stored all data like user name, data fatched from database of that user

and i stored that data and user name such as:

string strUserName="user name"

dataset ds =new dataset();// data of that user

now i wan yo send d whole data from my login page to user profile page

can anybody help me for that...................

and plz tell me that how much is this way is benifitial to send data from one page to another page

plz........kindly waiting for positive rply

Flash player doesn't send cookies while requesting an aspx page



 I'm developing a web-site, that uses SWFUpload for multiple files upload to the server. Page, that uploades files, is accessable only to registered user. Authentication is done via web-forms (authentication mode="Forms" in Web.config). Flash uploades files to special web page - upload.aspx. In IE everything works great, but Flash player in non-IE browser (in Firefox, for example) does not send any cookies to upload.aspx. Because of it no sesion and no authentication information is available in this page.

 I can pass all the information, necessary for uploading, in GET-parameters, which upload.aspx recieve. But this is a serious security hole and I don't want to expose session information. I can pass session identifier in GET-request. But the question is the following: how can I restore session information from the session identifier? How can I make HttpContext.Current.User point to currently logged in user in this case?

Any help will be appreciated.

User Control not accessing the value of the properties send to it from the aspx page.


I have a dynamic accordion on a page. Set its datasource to an object of paged data source.The user control is in the accordions content template. When i was writing code the properties were showing but after giving the values of databases as


<uc:UserControl1  runat="server" Property1='<%#DataBinder.Eval(Container.DataItem,"columname1")%>' Property2='<%#DataBinder.Eval(Container.DataItem,"columname2")%>'  ></uc:UserControl1>


but the values shows null, these properties are shown as textboxes text property by user control.

MoreOver when I checked the values of database Items.So i made a textbox instead of usercontrol here as

<asp:TextBox ID="txtTest" runat="server" Text='<%#DataBinder.Eval(Container.DataItem,"Columname1")%>'></asp:TextBox>

It is showing the correct value. And if i pass the value directly it is also showing correctly like

<uc:UserControl1  runat="server" Property1="XYZ")%>' Property2="ABC")%>'  ></uc:UserControl1>

. where I am wrong

the problem is eval is not passing the value to usercont

HyperLink use to send request parameter to another page


The statement is correct:

<asp:HyperLink ID="HyperLink2" runat="server" Text

public object on asp,net page


in asp.net can i make public objects on my page, for example

public Customer cust1 = new customer();

and use this object on my entire code???

what are the drawbacks of creating public objects??

a single object will be created for all users??? or each user will have a different object????

ASP.Net Page to send email from Yahoo/Gmail Account

I want my ASP.Net onbuttonclick to send simple email from my Yahoo/Gmail account. Any document pointing to how to set this up on settings etc ? Thanks 

Want to convert html page into pdf format & send same pdf as a attachment

Dear All i want to convert html page into pdf format & i have to send that same pdf  by attachment,if some one has the sample code , please send me

Cannot send List inside of Dictionary

List<string> receivers = new List<string>(); foreach (object item in listBoxControl1.SelectedItems) receivers.Add((string)item); Dictionary<string, object> inArgs = new Dictionary<string, object>(); inArgs.Add("Receivers", receivers); inArgs.Add("Sender", client.name); inArgs.Add("Message", memoEdit2.Text); inArgs.Add("IsGuaranteedDelivery", true); inArgs.Add("DataType", TransmitToClientDataType.ChatMessage); if (service != null) service.AddTask("orion_send", inArgs); There is an error with serialization at last string because List<string> object. I tryed to send List<T> object via WCF, it's succesfull. But why there are problems with List<T> included to Dictionary?

Using extensions with Object Class and Page in WPF

I don't usually ask a question without trying it first, but hey, why not.  Searching for this one is not exactly easy. I am wondering if I can use extensions with Object and if they (the variables) will subsequently be available for use in a Page partial class generated for WPF?  By this I mean in the same project and assembly. BTW, I won't be offended by posts pointing out why not to do this with Object.  The why in this case is something as basic as having one base class that contain: bYes = True; bNo = False; Now of course, having a base class is not going to work with something like Page... There may be much better ways to this, what I do not want is syntax MyBaseInstance.bYes and MyBaseInstance.bNo in MyPageInstance and bYes or bNo everywhere else.  Any advice? Regards,  Dave Horsman

How to send form result to e-mail from aspx page ?

Hello , I'm stuck with this problem. I have aspx page , (.net 4 , web form ) on this page I have 3 text fields, 3 radio buttons groups, and 6 checkboxes, and button ( submit) . I'm trying to send data to e-mail using button event. The problem which I found that CheckBoxes giving boolean, I want transfer it to Yes or Not. Radio button giving boolean or integer as well. And another problem, I want to send only part which has been answered. empty ( NULL ) field should be ignored. If you can point me in right direction could be cool. What the best way for this? Thank you!

The SQL Server performance counter 'Page Splits/sec' (instance 'N/A') of object 'SQLServer:Acce

I am getting these page split errors every 5 minutes I have tried everything reindexing rebuilding working with different fill factor values But nothing seems to effect this problem. The threshold is now set to 100 (what the max threshold number i can set the alert to ?) Also please let me know how to get rid of the pagesplit alerts. thanks

Send complete .aspx page by email?


I have a page that sends a email to user. Now I wonder if it's possible to send a complete .aspx page by email? If it is, how do I do this? Can I also use {0}{1}{2} and so on and send parameters? I have searched on this but I can't find what I'm looking for.

Transfer values from one page to another Request Object



I wanTransfer values from one page to another using Request Object

but when i try store

textBox value into Request object like..

Request["Name"] = txtName.Text;

i get the following Error

Property or indexer 'System.Web.HttpRequest.this[string]' cannot be assigned to -- it is read only

Is Request object allows us to store values init like Session & Application Object............

Transfer values from one page to another Request Object



I want to Transfer values from one page to another using Request Object

but when i try store

textBox value into Request object like..

Request["Name"] = txtName.Text;

i get the following Error

Property or indexer 'System.Web.HttpRequest.this[string]' cannot be assigned to -- it is read only

Is Request object allows us to store values init like Session & Application Object............
Taha Zubair Ahmed Software Emgineer.

Page in another page as an object


Hi All,

I am trying to check if a control exist on another page, so i have:

page1.aspx and page2.aspx

In page1.aspx, i need to check if page2 has an control with id "textboxFindMe", how can i do that?
Also notice that page2 is dynamically build, so control "textboxFindMe" only exist in a condition, like certain time of the day.

Ideally, i would like to return an object on page2.aspx and use it in page1.aspx. I assumed page2 need to render first, otherwise the control would not be exist to be found in page1.aspx

code will be something like:

Page2 _page2 = new Page2();
Control ctrl = _page2.FindControl("textboxFindMe");

Any ideas?
Many Thanks.

page inside update panel doesn't refresh the session object after postback of any control



I have many controls like dropdown, radiobuttonlist, etc on my page and I put all these controls inside the update panel so that the page doesn't look to be posting back when something is selected. Now the working on the page is very smooth. But the session object isn't getting refreshed even if I postback to the server and as a result even if the users are working on the page they are being sent to the login screen after 20 mins.

Is there anyway where I could put all the controls in update panel and still refresh the session after any postback(dropdown selection)

Any help is greatly appreciated.

Thanks in advance

how to persist a class object when page PostBack


i have created a user control UserControl.ascx, in Code behind file of UserControl.ascx i have created an object of a class MyClass.cs,
if(!Page.IsPostback) {
objMyClass= new MyClass();
but when i click on button of UserControl.ascx page and try to access objMyClass object then it set as null, so how to persist MyClass object when page PostBack, i wanted to keep object persist till the user access the page, when user goes out of this page then object should distroy?

To keep the object persist, i have used ViewState

So i have made MyClass Serializable and
i have used ViewState to keep my objet persist, but it give the error
like : UserControl is not marked as serializable.

so i have made my UserControl as Serializable, but the problem is still coming.

One more thing is that MyClass is also resposnsible to create some other class object also.

Can any one suggest me correct solution?

Problem i am getting when i try to PersisObject On UserControl

[SerializationException: Type 'ASP.common_grid_UserControl_ascx' in Assembly 'App_Web_44142fbl, Version=, Culture=neutral, PublicKeyToken=null' is not marked as serializable.] System.Runtime.Serialization.FormatterServices.InternalGetSeri

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