I have a page on which there is a parent organisation followed by a list of child organisations. To view the data of these child organisations, there is a GO button for each child organisation. I set the ID of the child organisation in a cookie on the click of the GO button. When I come back to the home page, I delete the cookie.
My problem is that in IE 8 the first time the GO button works fine. But when I come back to the home page and click on the GO button of the same child organisation, the ID is not set in the cookie.
This problem does not occur in Firefox at all.
This is the code in JavaScript where I set the cookie and then call my page.
function GetOrganisation(id, path) {
$.get('<%=Url.Action("SetOrganisationID", "AdminSettings") %>', { 'Organisationid': id }, function (data) {
if (data.Success) {
$.get('<%=Url.Action("GetOrganisationDetails", "AdminSettings") %>', { 'Organisationid': id });
In my project I have configured .NET's sessions to go into database.
I also have a global.asax which implements Session_Start().
In Session_Start() I write three things to the session:
The time the session started.
The user's host address.
A serializable device object wrapping the user's agent.
The problem is now that users which don't allow cookies won't allow session cookies either.
(Easily reproducable by putting the site URL to the restricted sites of IE).
If I keep on refreshing (put finger on F5) a new session is created for every request (-> no session cookie). Shortly, the web server process grows to some hundred megabytes.
It does not matter if you use IIS7 or Cassini Local Webserver.
The issue is now: the memory does not get released until the sessions time out. What is the logic here if sessions should really go to database? How long will .NET keep them in memory? Eventually, you'll even get Out Of Memory exceptions!
Anybody know? How to detect and prevent such (almost malicious) "attacks"?
I have a little problem with my sliding panels, I have a Page with 2 sliding panels (right and left). These panels have a 'slide button' and you can reduce panels by clicking on it. I use cookies to record state of panel, so when you change page panels stay collapsed or extended. But it doesn't work very well, in fact the state is recorded for the page. If I change page, panel will extend (default position) but if I go back on the page it will disapear. Is it possible to ignore the path in the cookie and use a cookie for all website? Jquery code :
$('#rightfold').click(function () { if ($('.menudroite').is(':visible')) { $('.menudroite').hide("slide", { direction: "right" }, 400); $.cookie('rightfold', 'collapsed'); $('.triggerdroite').animate({ backgroundColor: "#B2C9D1" }, 1000); $('#rightfold').animate({ color: "#000000" }, 1000); } else { $('.menudroite').show("slide", { direction: "right" }, 400); $.cookie('rightfold', 'extended'); $('.triggerdroite').animate({ backgroundColor: "#6c7a7f" }, 1000); $('#rightfold').animate({ color: "#d9f4ff" }, 1000); } }); $('#leftfold').click(function () { if ($('.menugauche').is(':visible')) { $('.menugauche').hide("slide", { direction: "left" }, 400); $.cookie('leftfold', 'collapsed'); $('.triggergauche').animate({ backgroundColor: "#B2C9D1" }, 1000); $('#leftfold').animate({ color: "#000000" }, 1000); } else { $('.menugauche').show("slide", { direction: "left" }, 400); $.cookie('leftfold', 'extended'); $('.triggergauche').animate({ backgroundColor: "#6c7a7f" }, 1000); $('#leftfold').animate({ color: "#d9f4ff" }, 1000); } }); // COOKIES var leftfold = $.cookie('leftfold'); var rightfold = $.cookie('rightfold'); // Set the user's selection for the left column if (leftfold == 'collapsed') { $('.menugauche').css("display", "none"); }; // Set the user's selection for the right column if (rightfold == 'collapsed') { $('.menudroite').css("display", "none"); };
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.
I have a link containing ID & name on the URL, based on the ID & name i returned image data from DB via asp.net method. The link is not loading the image first time when the link is clicked, when you refresh again the image comes back.
having an impossible time getting asp.net 4.0 to work in any fashion at all. In fact, I completely wiped my server,reinstalled with Server 2008 R2 Standard (running on a VMWare ESXi box, not that it should matter),and cannot even get a test .aspx page to work.
I'm wondering building a website like StackOverFlow (approximately the same features using ASP.NET ) How much Work-power and time does it take in your opinion . My boss has asked me to estimate for work-power , time , cost and suitable technologies .
Whenever I add an entry to the Hosts file on Windows, it takes a long time for the change to take place? I have tested using Firefox and IE and it seems to take around 5 minutes on both of them before the new IP/Domain entry on Hosts is recognised.
Is there anything I can do to overcome this? Perhaps "refreshing" the cache in some way? ipconfig /flushdns doesn't work.
I cannot use asyncFileUpload as it has too many restrictions which doesn't meet our requirement.
I'm able to add a updatepanel trigger to force the Button1 to perform a postback. after the file uploaded, I need to use a timer to do different tasks and return messages back to client with the timer. That is all fine.
However, when one upload is finished. I try to do it again. The FileUpload1.HasFile is "false". I don't know why. if I remove the timer, at the second time, the HasFile is "true". I think there must be something in the timer and disable the Button1's postback.
I have a simple GridView with AutoGenerateColumns,Edit and DeleteButton = true
It's data source is a DataTable dynamically generated.
Since i don't want to use object data source, i just catched Delete event and deleted rows from datatable and made a new databind. It works.
I tried to use also AutoGenerateEdit button, but when i click on Edit command field, nothing happes. So i decided to handle by myself edit events, and changed datagrid in this way:
I have a gridview 'gvTemplates' that loads from the Page_Load method. It is using a stored procedure and this works fine. Then I do a search function on that gridview and that works fine. So when I click the search cancel button, which calls the same exact code that loads the gridview from Page_Load, I get the dreaded 'Input string was not in the correct format'.How can the exact same code and stored proc work fine the first time but fail the second?Gridview:
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.
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()?
The whole thing is in a form, and it doesnt postback when this button is clicked. Im no good with javascript, but i got a feeling thats not the problem.
I have a .net 3.5 app that uses forms authentication. I recently decided to utilize the built-in "Remember me next time" on the login screen. I thought it would be a very simple thing (it is a 'built-in' feature afterall). Unfortunately it did not work on the first try. I then spend many hours browsing the Net and reading many posts about problems associated with the feature. My environment is as follows:
client machine: XP SP3, IE8 server: Windows Server 2008, IIS7, application .net 3.5
The relevant sections in the Web.config in the root of the app directory:
My web application has hosted on the canada server but my all clients are indians.So, as I am using System.datetime.Now to store all the dates in application.Obviously, it is displaying the canadian time instead of india time.How can i do it?Is there not any gloabl settings that we can do in our web.config file so that it indicates to the server at run time which time zone to execute..?Or any other suitable alternate?
i have to listen my mail server for every 30 min. i have a distribution list and i want to count number of email comes for that distribution list and no of replies goes from the outlook for every 30 minutes. also i need to get the time difference between the replied time with arrived time of the mail. so show me some sample code
I'm using Telerik's RadScheduler Control with WebService Binding.
I've used RadScheduler with Server Side Binding which has an event called "OnTimeSlotCreated" which fires every time when a particular time slot creates so that i can access the time slot and get the control (HtmlTableCell Control) to modify it according to the requirement.
But now i'm binding it from client side through WebService which has no such "onClientTimeSlotCreated" event, also these time slots are not having any identity at client side to access.