How to set login url programmatically for Forms Authentication ?
-
Hello, I am wondering how I can set the LoginUrl property of the Forms Authentication programmatically ? So far I see, i need to hard code this value in web.config file. But that is a problem. I need to use absolute SSL url for login url like, "https://myDomain.com/Login.aspx" if the application is hosted in production server. If it is running from localhost, then this property value should be "/Login.aspx". Of course, most of the developers are using SSL for login page, so I hope there should be a solution to this problem. Would anyone tell me how ? I tried to set
if(Request.IsLocal)
FormsAuthentication.LoginUrl = "https://myDomain.com/Login.aspx" ;in Global.asax file's Application_Start event, but I see that, FormsAuthentication.LoginUrl is a readonly property, so above try wont work. Anyother way ?