Web Forms :: Losing My Cookies
Mar 4, 2011
I have a situation where I write a cookie on one page and read it on another page, but it only works for users who are in the admin group onour web server.On my default page, I have this code in the page load event to get some user data from my database and save it for later use:
HttpCookie c = new HttpCookie("userinfo");
c.Values["domainaccount"] = _CtaUser.DomainAccount;
c.Values["userid"] = _CtaUser.UserID.ToString(); [code]....
And it's gone.Again, it works for me and one other programmer who are in the admin group on the web server, but not for anyone else.
View 3 Replies
Similar Messages:
Aug 17, 2010
I'm handling cookies using JavaScript to store some values in my asp.net web application.I use document.cookie to save some values (converted into a lengthy string). But i want that value to be accessible across all the pages in my application.When i try to get that value from a different page, i get the values pertaining to the document in the current URL.
In short i save the value in the cookie in http://myapp/doc1.aspx and want to retrieve it in http://myapp/doc2.aspx
So is document.cookie is pertaining to a single document scope? How can i save/read cookies across the site?
Update.This is how i get and set cookies
function getCookie(c_name)
{
try{ [code]...
But i'm getting different values for the cookies in different pages.
View 2 Replies
Nov 23, 2010
I have been experimenting with code that will clear all of the cookies in an HttpContext.Response.Initially, I used this:
DateTime cookieExpires = DateTime.Now.AddDays(-1);
for (int i = 0; i < HttpContext.Request.Cookies.Count; i++)
{
HttpContext.Response.Cookies.Add(
new HttpCookie(HttpContext.Request.Cookies[i].Name, null) { Expires = cookieExpires });
}
this will error with an OutOfMemoryException because the for loop never exits - each time you add a cookie to the Response, it also gets added to the `Request.
View 1 Replies
Apr 1, 2011
I know that if I have set a cookie on a previous request, it will show up in my Request.Cookies collection. I want to update my existing Cookie. Are the cookies from my Request.Cookies collection already copied to my Response.Cookies collection? Do I need to add a new cookie with the same key using Response.Cookies.Add(), or do I need to use Response.Cookies.Set()?
View 1 Replies
Feb 3, 2010
I have a 3 page vb.net web application (long story, but it has to be multiple pages). Page one has a datagrid that has rows of data. When a user selects a row, I check to see what "RecordType" corresponds to the row selected. If the RecordType = 1, Page Two loads. If the RecordType = 2, Page Three Loads. The problem I've run into, is that once page two or three loads, all the data is lost. In the gridview, I have the several values in the DataKeyNames, but "loose" them all between pages. Is there a way to pass this data to the next page other than ...Session - I guess I could set the values in the datakeynames as session data.. right?
QueryString - I really don't want to use querystrings, as I don't want users "messing" with the URL.Is there another option available in .NET? I'm kind of hesitant to set sessions, because I'm afraid the values won't get cleared out as needed...
View 4 Replies
Feb 19, 2010
I have an upload control (csv file) of which I use the stream to retrieve data in a datatable that I then bind to a datagrid, sitting in a repeater control.I have to bind more than one record to the repeater, therefore I need to find a way of storing the stream for each binding, so that I can bind it to the datagrid again, via itemdatabound event of repeater.
I have tried storing the stream in the repeater's datatable but on each postback, the content of the stream gets lost. The stream still exists, but its length is set to 0.I have tried storing it in a session object, but again it is reset to 0.
I have tried using viewstate but I get a xmlserialization error. Saying IXmlSerialization is not implemented.I am desperate to find a work around as I am feeling the pressure at work.
View 3 Replies
Mar 10, 2010
I'm a little confused here. In the code-behind of an ASP.NET page, I have a private DataTable that I set on the PageLoad event, which I use to populate controls on the page. However, it seems to get lost (set to Nothing) after the load event.Is this normal?
How do I hold onto a DataTable object after the page loads? This is also very confusing as to how I am supposed to submit updates to the SQLServer db when any changes are mande to that datatable. I mean:
1. PageLoad, set DataTable, set controls values to corresponding columns in Datatable.
2. User changes a textbox value, then start a .BeginEdit(), DataRow("Field) = txtboxvalue.
3. Update button clicked should submit DataTable to Webservice that references a DAL that accepts the DataTable for db update.
View 2 Replies
Jan 24, 2011
On my page I have some text boxes that users can enter values in. The first time they submit the page it gets the values from the text box fine. But when the user goes back using their browser back button and changes a value and resubmits, it shows the value from the first time they submitted, not the new value they just entered.
View 6 Replies
Feb 19, 2010
Is there a way to keep (automatically) the data posted before a redirects to the another page? And then reapply the post data to the this Page upon return? Here is what I want to do :
[Code]....
I noticed that some websites are already doing that. Such as phpbb forums, when composing a message and the session expired we are redirected to the login page and then we return to our post without anything lost. However, I know that it is in PHP but it remain a web application at all ;) I thought of a system of modal box that will appear directly in my MasterPage so don't need to redirect, but I do not like the idea. If I don't find any solution this could be a workaround. But I don't like it.
View 2 Replies
Feb 13, 2011
I have had a website on a shared web hosting plan for over a year with no issues with keeping persistence. It's been prettys stable, and the only drawback of the host I am using is that it's very slow on occasion...sometimes taking 5-10 seconds to load a page.
So over the last few weeks, I went searching for another web host and and testing one out now.So while my existing website is still running the old web host, I copied the code and data and pushed it on the new web host. It's up and running, but I noticed that shortly after I log in (Forms Authentication), I am logged off within 20-30 seconds.I decided to add the machineKey to the web.config, and it seems to have fixed it.
My question is why would this have fixed it? I asked if the host's servers were in a web farm.
View 5 Replies
Jul 3, 2010
Private Sub UpdateOffensiveStats()
Repeater losing data on postback
View 2 Replies
Nov 3, 2010
i have a global field called hotelId. i then have this piece of code that gets a value from gridview row:
[Code]....
the local variable is assigned to my global one, which gets passed to my method along with other variables. while stepping through i can see the value is set, but when i hit the submit button variabl is passed to another method except my hoteId. it gets lost...
View 3 Replies
May 20, 2010
I have a gridview with auto Edit buttons... when I click on Edit button it is losing it row and column colors.We are initially setting the gridview colors in the page_load event.
View 3 Replies
Apr 8, 2010
I have a gridview and dropdownlists that I want to use to filter the gridview by. I am trying to mimic the Filter functionality in Excel.The current problems I am having are:The dropdown is losing the selected value during the postback. It selected value goes back to All.I cannot use the dropdownlist to select "All" to remove the filter.ode is below.Page Code:
<%
@
Page
[code]...
View 3 Replies
Dec 28, 2010
how to create unlimited user control without losing the data... My problem is on postback.. i searched a lot but m not get solution.. my question is how to recreate unlimited controls(textbox,dropdown) and how to maintain the data in the controls.. Now am able to create dynamic usercontrol (unlimited) when Button click event using for loop but not able to maintain the data during postback.
View 1 Replies
Jan 11, 2011
I have the following gridview...
[Code]....
And inside that gridview you can see I have a dropdownlist called dpdTrueFalse. That dropdown has two values which I am loading from code behind like this...
[Code]....
I have a submit button outside that gridview that checks each row and the selected value in the dropdown. But for some reason, even if you select another item in the dropdown, it always selects the first item in the dropdown when I click the submit button. I reckon its because of the postback.
View 5 Replies
Dec 30, 2010
I have a FormView that is used to insert records into a table. It is set to a default mode of insert. When I click a LinkButton it makes the FormView visible and populates a DropDown List control via code. When I click the Insert button, it inserts the record into the table but then the DropDown List selections disappear. How can I keep the selections so that I only have to fill it once?
View 3 Replies
Jan 6, 2010
I'm new to the asp.net/vb.net world and have stumbled across a problem.I have a page that has a gridview. When the user clicks on a link in the grid a modal popup is shown (using the AJAX modalpopupextender).On this pop up is a treeview that the user can then select some child nodes.When they click a button a table is dynamically populated with the list from the selected treeview nodes.The user can then add detail in this table comments etc and then should be able to click on a save button. This will then fire the event to loop through the table and insert these records into a database.The problem is that when the Save button is clicked the page seems to have lost all reference to the fact that there are dynamically created rows in the table even though there are a number of rows that you can still see displayed on the page. Even the table.rows.count shows 1 at this point!
View 3 Replies
Feb 21, 2011
I have an aspx (parent) that call ShowModalDialog another aspx (child). and on the child, i close the windows using script
Page.ClientScript.RegisterStartupScript(Page.GetType(), "reloadpage", "var link;link=window.opener.location.href;window.opener.location.href=link;self.close();", true);
The child window close, go back to parent window, and reload the page and no confirmation box to refresh the page, working as expected. but all my previous entry to the screen is gone. how to retrieve it back or any work around?
View 4 Replies
Feb 26, 2014
I am trying to upload large videos(more than 1GB) to youtube from webpage. But youtube is allowing me to upload max 8MB videos. So I want to reduce the size of the video and then upload the reduced video to youtube. So, how to reduce the video size.
View 1 Replies
Aug 26, 2010
I'm using Request.PathInfo to response.redirect as user to a different page ( based on the content after .aspx ). It redirect just fine however, once redirected, the page loses all content from the master page and the CSS link.
View 6 Replies
Aug 18, 2010
Using the code below, I am able to load my dynamic dropdownlist and supply it's selectedindex. But when I fire the update command I can see that the information displayed has been lost.
when I fire the update I don't lose data!
[Code]....
View 3 Replies
May 15, 2010
I have a dropdown list inside a gridview:
[Code]....
View 12 Replies
Mar 30, 2010
I have to use a cookie in all my asp.net pages.I am not using any master page.HttpCookie obj;obj=Request.cookie("sdf");so, i have to use this in every asp.net page
View 6 Replies
Oct 4, 2010
I hear from some one that Yahoo.com delete cookies["Name"]. from there application and use new Features beside it. i dont know what is it.. what they use in there Application.
i want to use that feature in Asp.net
View 3 Replies