State Management :: Persisting The Cookie Across Development And Production Server?

Jan 2, 2011

I am using this code to pass variables from ASP.NET application to HTML Application:

[Code]....

The above code is run from page_laod event, and I am making some development changes on the Development Machine (say
http://eutdev02/ehrmd).

After the ASPX page is loaded, and I debug the javascript in the HTML (F12 under IE8), and can see the Cookie is found in the browser.

But, when I open the target HTML/Javascript web page (which will read the cookie prmStaffID), but the HTML Page is on the production machine (separate server say

http://prod01/Attendance.html), the Cookie is not found !!!

It seems to me that Cookies will persist only on one IIS Server, and will not be global.

Question:How I can persist the Cookie on the Client Machine regardless of the the Server Machine ?

For testing purposes, I want to send the cookie to the client from teh Development Server, but the target application is under HTML/Javascript, and I want to be able to read the same Cookie using Javascript.

View 5 Replies


Similar Messages:

State Management :: Cookie Does Not Work On Server?

May 4, 2010

I am developing a asp.net 3.5 web site. Cookie is used to store username when site user logins in the site.This works well on my local computer when I'm debugging it with Visual Studio.But when I publish the site and upload it to the server, cookie could not store username.

My code is as below:

//Write COOKIES

HttpCookie loginState = new HttpCookie("loginState",email);

Response.Cookies.Add(loginState);[code]....

View 8 Replies

State Management :: Cookie / It's Cause The Sql Server Update Twice :|

Dec 22, 2010

I have a website of online games and I try to count and show the number of the uniqe visitor per game page, by using Cookies only. (if someone visit after 24hr it will be uniqe visitor too)

the problems is:sometimes (I don't know why), not always, it's update the counter colomn of the game, +2 instead +1, and I don't know why, there isn't any "for loop" etc.. maybe is't because the url rewrite? but it work fine if people enter again the colomn will not update again, the problem is that is update +2 instead +1 (see the code at the bottom)this is my algorithm (something is wrong in this algorithm so don't use it):

1. put the query string in variable (the name of the game) - i'm using url rewite.


2. use this variable for select the game Name (and another information) from the database (and for the cookie I will use the game name from the database and not from the query string to avoid from capital letter problems, because cappital letter for the first word isn't good because words like of, to etc..).


3. for each pageload (there isn't postback in the game page) check if the cookie of the uniqe game exists

4. if not exists, create a cookie for the unique game (the name of the cookie and the his value will be same, because I don't care about it, it's only for check if the cookie exist, and I can't use one cookie for all the games because each time visitor enter the cookie will create for 1 day).

4. after this creation of the cookie try to find if the cookie exist (for cheaking if the user didn't disable the option for cookies)

5. if yes update the database column of the spesific game

the code:

In the end of the page_load - (the GameName is the virable of the name of the game from the database and not from the qury string).

[Code]....

and the update function

[Code]....

View 4 Replies

State Management :: Remove Item (Cookie) From Basket (Cookie Collection)?

Sep 8, 2010

I am busy building a shopping cart with cookies. I have datalist which I populate from the cookies with a delete button next to each cookie

[Code]....

Now the problem is that when I hit the delete / remove button to expire the cookie, what happens when repopulating the datalist is that it shows the original cookie with all it's values as well as a new entry where all the values are blank.

View 3 Replies

State Management :: To Prevent The Server From Setting Cookie On The Client Machine?

Sep 2, 2010

I have deployed a Web application on IIS 6. I want to prevent my server from setting cookie on the client browser. I am using the following setting on the web.config file.

< sessionState
mode="InProc"
cookieless="false" [code]....

However, it looks like its creating a default cookie named ".ASPXAUTH" in the client machine. I dont want my application to create any sort of cookie.Is there anything specific I need to do in web.config?

View 3 Replies

State Management :: Updating Cookie / Change The Value In A Cookie?

May 10, 2010

I want to change the value in a cookie:
HttpCookie hc = new HttpCookie("HiddenColumns");
hc.Value = customView.HiddenFields;
hc.Expires = DateTime.Now.AddDays(365);
Response.SetCookie(hc);

Or this way:

Response.Cookies["HiddenColumns"].Value = customView.HiddenFields;;
Response.Cookies["HiddenColumns"].Expires = DateTime.Now.AddDays(365);

But when I retrieve the cookie value, it is still old, unless I do postback. I don't want to use Redirect.

View 2 Replies

State Management :: Creating Cookie With Client Scripting And Updating From Server Side?

Aug 9, 2010

cookies are generated from the client scripting.e.g. document.cookie = city=NYC;

I want to update this from GUI using

Response.cookies["city"] = LA;

I could not understand why this is not possible.( I read about Httponly and all that stuff but still not clear).If I use Javascript in code behind page then I am able to change the value.e.g.

Literal ltMsgUpdate = new Literal();
ltMsgUpdate.Text = "<script type='text/javascript'>document.cookie = 'city=LA';" + "</script>";
Page.Controls.Add(ltMsgUpdate);

But I could not use this type of code because there is response.redirect statement in the function where I am updating cookie using (response.cookie) and that's why the javascript code never runs.

Bottomline: I want to update cookies in code behind page which is generated in client scripting.

View 4 Replies

State Management :: Persisting A Class Object?

Nov 5, 2010

I wish to persist a class object across postbacks by using a single session variable/object/whatever.

The class has about a dozen single variable properties; and about a dozen table properties; and several methods. The main table tracks rows of sporting event results. The web site will collect one row at a time for each postback. The data in the object's constructor is based on a dataset, but the data in the class will grow each time I do a postback so I don't want to loose the information in the class. The data isn't very big - it will fill a single computer screen.

Being new to programming I am thinking that I can store the dataset in the session but that would slow down the response time because I the methods would have to be called to refine the data - or maybe I can just store the entire class object in a session.

View 3 Replies

State Management :: Persisting DropDown List Attributes Across Page Postbacks?

Oct 12, 2010

how can DropDownList attributes be persisted accross page Postbacks?

Example:

DropdownList1.AutoPostBack = True
DropdownList1.items(0).Attributes.Add("Attribute1","somevalue")

On Postback the attribute is no longer available (ie. attributes.count=0).

I tried persisting using the code below, but was unsuccessful:

Before PostBack: ViewState.Add("DDL","DropdownList1")
On PostBack: DropdownList1 = ViewState("DDL")

This generated the error: DropDownlist is not marked as serializable.

I than tried:

Before PostBack: Session.Add("DDL","DropdownList1")
On PostBack: DropdownList1 = Session("DDL")

This did not err but attributes were still not available.

View 4 Replies

State Management :: Dynamically Loaded Controls In Init But Viewstate Not Persisting

Jan 20, 2011

I read this article first to try to solve this issue, but I am already loading the controls in the Init phase of the page, yet viewstate is not persisting. Any ideas as to why? (Of note is that this is for a custom module in DNN and I do have some AJAX update panels on the page, though this section is not within an update panel, for what it's worth.)

As an overview of what I've got:

1. LoadControl.ascx - based on reading query string parameters, determines whether to load the master or the detail .ascx.
2. Master.ascx
3. Detail.ascx

In my master control I dynamically load either a master or detail sub-control in the page_Init. The detail page has a treeview control and then uses a multi-view control to display the panel associated with the depth of the node selected on the tree. On the panel being displayed I have a cascading ddl within a detailsview control which initiates a postback to select the child ddl based on the parent ddl selection. However, when the page refreshes after the postback, both ddls have resorted to their default selection.

What is interesting however, and I just realized this as I am typing, is that the Treeview is populated when the page comes back from the postback, so that is only possible if viewstate is being persisted right? (See the page_load code and you'll see that Call PopulateRootLevel(intTreeUserID) which populates the treeview, is not called on postbacks....hmmm.

Any ideas as to why the treeview maintains viewstate but not my ddls???? But though the tree is populated, I do have to explicitly select the node again and set the panel that the detailsview control is on to visible again too....

Here is the dynamically loaded control code:

[Code]....

And in the Detail.ascx page load I've got:

[Code]....

[Code]....

View 6 Replies

State Management :: Asp Create New Session State Cookie Each Time On Debugging?

Jan 21, 2011

I'm using the following line of code to display the number of users currently logged on:

lblNoOfUsers.Text = Membership.GetNumberOfUsersOnline().ToString()

I'm still debugging my application so it's on the local server. As I debug and stop then debug again, eventually lblNoOfUsers.text turns to "0" instead of "1", even as I'm navigating my application. It only turns to "1" again if I log out and sign back in. It's almost as though Membership.GetNumberOfUsersOnline my login are referencing two different session states. How is this possible? Does asp.net create a new session state cookie each time I start debugging?

View 2 Replies

State Management :: Session And Session Variables Not Stable In Development Server?

Oct 11, 2010

I use some session variables to get the job done(shopping cart, etc) but it is not stable..manytimes I get no items in session object and other times(refreshing the page) I get missing data...I downloaded the entire site code to my local pc and debugged it and run it succesfully without any session data missing...When I run it in the server, I get bad session again: no products in shopping cart or products with missing quantities...

The same website runs smoothly in our production server too....The problem is with our development server...

View 2 Replies

State Management :: Can't Get Value Cookie

Jul 6, 2010

i have trouble about cookie path: I use VS 2005, code as:

HttpCookie aCookie = new HttpCookie("lastVisit");
aCookie.Value = DateTime.Now.ToString();
aCookie.Expires = DateTime.Now.AddSeconds(30);
aCookie.Path = "/TestCookie";
Response.Cookies.Add(aCookie);

Seem that , i can't get value cookie,although my variable on page which inside TestCookie folder I try get cookie other pages which outside TestCookie folder ! Result is like before attempts.

View 4 Replies

How To Host Site With ASPNETDB.MDF Database From Development Server To Production Server ?

Jan 21, 2011

I have created my site using ASP.NET Personal Starter Kits 3.5. I use Visual Studio 2008 only . .with its built-in SQL Server (2005 Express) ... my database in App_Data is ASPNETDB.MDF ...

I have created some of my tables also ....in ASPNETDB ..

In my local PC the site was running fine ...

But when I publish my site on production server it doesn't work and shows the following error

<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>


Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>


My hosting provider connection string ..

<add name="ConnectionString" connectionString="Data Source=69.16.253.19;Initial Catalog=usa_data;Persist Security Info=True;User Id=user;Password=pass" providerName="System.Data.SqlClient"/>


My hosting provider gave me the connection string to connect to the SQL Server 2005 but it doesn't work...

I don't understand why my site was running fine using the production SQL Server 2005 in my local PC when I include ASPNETDB.MDF file in App_Data in my local pc only ..if I remove file ASPNETDB.MDF from App_Data of my local pc ... the site stops working ...

Can anybody tell em how to fix this ... !! I am very tensed since last 3-4 days

View 1 Replies

DataSource Controls :: How To Transfer Data From Development Server To Production Server

Jul 8, 2010

how to transfer my data from devlopment server to production server ,i have already records exist in my database if i go for script then how can i transfor record in script i can transfor only table ,procedure and views.I am using SqlServer 2005.

View 2 Replies

State Management :: Cookie Value Disappeared?

Feb 13, 2011

We are using asp.net and 3.5 framework. I have a process that sets the value of a cookie named "mystaffid" in the Default.aspx code behind page. This holds the unique ID of the internal user (intranet). Now when I leave one of the web pages to go to another page in the same website I am getting the error "Input string was not in a correct format. " on the 3rd line below. how the cookie disappears? Also, this is happening in the Page_Load of the master page and I am doing the exact same thing in other pages with the same master page and not getting the error. The cookie is set to expire in 1 day when it is set in Default.aspx.

Dim intStaffID As Int32 = 0

If Not Request.Cookies("mystaffid") Is Nothing Then
intStaffID = Convert.ToInt32(Request.Cookies("mystaffid").Value)
End If

View 2 Replies

State Management :: Get New Session Cookie In IE7?

Oct 22, 2010

We have a local homepage, which connect to our production security environment. When I need to test my site in test environment, I need to get fresh cookie (not the one that was sent to me via production security service, when I opened IE with local homepage).

I am getting fresh cookie fine in Mozilla; but in IE I always have production cookie, and this disables my testing. What I should fix here?

View 4 Replies

Configuration :: Switching Between Development Server And Production Server?

Mar 22, 2010

I am wondering the best way to change my connection string based upon which server I am accessing.

Essentially, all of the development is done on our local machines - once we think it is working, we upload it to our development server. In these 2 instances, I want my application to go off of our "dev" connection string for the SQL database in the web.config.

However, once it is published to our production server (for an internal application), I would like the connection string to point to our live db.

I am using the N-Tier model by Imar Spaanjaars - and have it setup like he suggests - In my DAL I have a class called AppConfiguration -

In this class I have a public readonly property ConnectionString() which returns the connection string in the web.config.

This is in an individual class library. What I would like to do is something similar to:

If server is localhost OR devstring return devString else return productionstring

View 1 Replies

Configuration :: Move A Local Development Database To The Production Server?

Jul 28, 2010

Problem: I need to move a local development database to the production server without any of the test data.

I am running SQL Server Express 2008 and SQL Server Management Studio 2008.

To create my ASP.NET Membership 2.0 system I created the DB initialy and ran aspnet_regsql.exe

I then added my own tables manually to store additional information.

I adjusted the web.config file with an application name.

When I ran a sript the application ID name was created and populated in the aspnet_Applications table. My script created a new member created and added to the admin role. Ok so everything go so far.

Now I want to move the local DB to the server. I know the connection string and can change this in the web.config.

My hosting company doesn't provide restore, so I don't think I can backup and restore

Q 1. What would be the best way to move the database across. Bearing in mind I need to clean the database out of test data.

Would it be just generate an SQL Script for the database and run it as a query on the server? And if this is the best way then do I need to set the permissions for the ASPNET user?

Q 2. What is the best way to clear out the data in the local database.?

View 1 Replies

Web Forms :: Functionality Working In Development System But Not In Production Server

Feb 11, 2012

I have a functionality working ( functionality for making controls visible / true false ) on my development system having windows 2008.

But the same is not working onĀ  production server having windows 2003 on IE.

View 1 Replies

State Management :: How To Store Object In Cookie With C#

Apr 10, 2010

I'm using session to store C# object but my session is expiring regularly.

I've given 540 minutes for session timeout. ( <sessionState mode="InProc" timeout="540"/>)

Now I want to use cookie instead of session to remove this timeout problem.

code below:

[code].....

View 17 Replies

State Management :: Way To Make Cookie That Contains A List

Jun 3, 2010

I want to make a cookie that contains a list and then i want to be able to get the information from the list by entering the list items specific key value. I quickly made a test application to see if it works or not and the code that im posting below is Not working

[Code]....

View 7 Replies

State Management :: Cannot Create A Simple Cookie

Feb 28, 2011

Very new to ASP.NET and C# (somewhat knowledgable in PHP) I have an ASP.NET web application and need to manage access to pages based on a 'status' stored in a cookie. I would like to use the following code to create the cookie in a login method.

HttpCookie cookie = new HttpCookie("UserCookie");
cookie.Value = "status"; <-- this will be replaced with a variable once its working
cookie.Expires = DateTime.Now.AddHours(1);
Response.SetCookie(cookie);

My problem is that the only place I can put this code where it works is in the global.asax Session_Start method. It simply doesn't work anywhere else. I am checking the cookie creation in firefox options and see the ASP.NET_SessionId created but nothing else (This is all running on localhost).

Is the session status somehow interfering with the cookie creation? Do I need to configure something in Web.config? It would appear that the only time I can create a cookie is on Session_Start. Does anyone have any tips, perhaps I am missing something simple?

View 6 Replies

State Management :: How To See The Sessionid Cookie On IE Browser

Apr 8, 2010

I want to see the asp.net_sessionid cookie on my IE browser. Where can I find it ?

View 8 Replies

State Management :: How To Look At The Actual Cookie That Is Passed To .net

Nov 9, 2010

Our app uses session to keep track of users. We stuff their user id into session on logon. If the browser cache is cleared any refresh to the page is done then the user will see the log out sign - as the app cant get theuser id from session as the aspnet_session cookie wont be present in the request.Firefox works correctly but when I clear the cache on i.e. the session is maintained. The session ID's are the same for multiple requests.how I can debug the app to see what cookies its getting. How do I look at the actual cookie that is passed to .net?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved