Developer forum

Forum » Development » Avoid System.Web in custom webapi

Avoid System.Web in custom webapi

Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Hi,

 

We are building some custom webapi's and are trying to get rid of the System.web dependencies, much like we do with all Razor templates.

 

I looked at some recent threads such as https://doc.dynamicweb.com/forum/development/development/dynamicweb-api-adding-custom-api-to-swagger-list and at the time we still had to use System.Web for

System.Web.HttpContext.Current.SetSessionStateBehavior(System.Web.SessionState.SessionStateBehavior.Required);

 

Is there another way to do that now?

 

Best Regards,

Nuno Aguiar


Replies

 
Nicolai Pedersen
Reply

Nope - that is the actual MVC hookup infrastructure and that has to be changed no matter what when moving to DW10. You controllers and routes has to be updated as that is by definition system.web in current environement. But the API underneath the controller surface should not use system.web

If you love your life, do not use session state in webapis...

 
Nuno Aguiar Dynamicweb Employee
Nuno Aguiar
Reply

Thanks Nicolai,

 

I do love my life, and as a result, we made some architectural changes to keep our custom webapi stateless

 

You must be logged in to post in the forum