Web.Security without a web application

0

Right now, I have an API and a website running in the same application. And I'd like to split it to 2 applications so, API alone and web alone. In the post request I use this for login:

if (WebSecurity.Login(model.UserName, model.Password,persistCookieInfo))

How can I do something similar then I do not have a Web.config file. I will like to do it without a Web.config file if that possible.

Or can I specify the connectionString somewhere else?

I have tried:

WebSecurity.InitializeDatabaseConnection("Data Source=.\SQLEXPRESS;Initial Catalog=****;Persist Security Info=True;Integrated Security=true"
, "UserProfile", "UserId", "UserName", autoCreateTables: false);

Tried with DefaultConnection don't know how to specify a default connection. The error I get is:

System.IO.FileNotFoundException
  HResult=0x80070002
  Message=Could not load file or assembly 'System.Web.ApplicationServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. 
c#
.net
api
asked on Stack Overflow Aug 15, 2019 by jacob sørensen • edited Aug 15, 2019 by SamCap

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0