Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to set login url programmatically for Forms Authentication ?

How to set login url programmatically for Forms Authentication ?

Scheduled Pinned Locked Moved ASP.NET
securitycomsysadminhelptutorial
1 Posts 1 Posters 8 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Nadia Monalisa
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups