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.

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

1 Answers1

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.

Reaces
  • 5,597
  • 4
  • 38
  • 46
  • thanks , but coming to sessions, see my edited post, `Session["FirstName"] = "John";` -- can this be used in azure ? – Shaiju T Jul 04 '16 at 07: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 04 '16 at 08:06