0

We are trying to migrate our web app hosted in go daddy to Azure. And i am concerned about feautures not avalibale in azure after reading this post about Top 7 Concerns Migrating to Windows Azure.

Will cookie across domains work ?

We have a site with sub domain.

example.com -- Main Domain

sub.example.com -- Sub Domain

This is how we use cookie.

Set cookie in Main Domain.

 HttpCookie myCookie = new HttpCookie("SiteUser");
 myCookie.Domain = ".example.com";
 myCookie["CustType"] = "Full";
 myCookie.Expires = DateTime.Now.AddDays(1d);
 Response.Cookies.Add(myCookie);

Read cookie in Sub Domain.

if (Request.Cookies["SiteUser"] != null)
{
HttpCookie item = Request.Cookies["SiteUser"];

}

Session State

This is how we use Session State in current application

Session["FirstName"] = "John"; -- can this be used in azure ?

It seems for Session in azure we have to uses Redis Cache Service as posted here

I would like to know what basic features of asp.net like sessions,cookie etc will not work in azure and the solution.

Any help would be great.

  • Which part of the article makes you think your cookies would be affected? – Reaces Jul 4 '16 at 7:12
  • @Reaces i have edited the post Actually the article deals with Session State, i am concerned weather both cookie and session will work ? – shaijut Jul 4 '16 at 7:25
  • Note that the article you reference is for Azure WebSites/ASE and not Azure VMs – CtrlDot Jul 6 '16 at 3:15
1

The only thing related to sessions, is the state-less nature of Azure VM's.

This means that you could possibly lose one of the more popular ways of storing a session state.
From the article you linked:

The most frequently used provider is the in-process memory provider, which stores the state in the memory of the web server it is running on. It relies on the load balancer configured for ‘sticky sessions’. Since the Windows Azure load-balancers are non-sticky, you can not use this provider.

However this is largely unrelated to cookies.
For more information on the difference between cookies and session states, there are some pretty good resources out there.

Cookie should be used to store per-user information for the current Web session or persistent information on the client, therefore client has control over the contents of a cookie.

Session is used to store per-user information for the current Web session on the server. It supports using a database server as the back-end store.

Cookies will work just fine on cloud providers.

  • thanks , but coming to sessions, see my edited post, Session["FirstName"] = "John"; -- can this be used in azure ? – shaijut Jul 4 '16 at 7:58
  • 1
    @stom I'm not a programmer, I'm a systems administrator, so I'm not entirely sure. I would suggest you test it out, there are ways to get cheap / free development servers on Azure for just this kind of thing. – Reaces Jul 4 '16 at 8:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.