OLD ASP.NET Web Forms RRS feed

  • Question

  • I created a Web Forms application a LOOONG time ago. There's no start up folder, startup.cs, startup anything. There's a default page that redirects to the original login page I created. That's what I have NOW.

    What I want is to do away with the custom login page in favor of using Azure AD. Everything that I have found to do this mentions a startup file and folder that I do not have. 

    Question: Is there a way to use AD in the OLD web form applications (literally no startup file, I can create one but I'm sure there's more to this than just naming a file "startup") or is my only option to upgrade my entire project?

    Wednesday, November 13, 2019 4:30 PM


All replies

  • Yes, you can definitely do this. You can follow the code sample my colleague Mohit Verma created on Github.


    On the Azure AD side you need to do this: 

    1) Create an app registration and add a reply URL (whatever URL in your web app you want the user to be redirected to)

    2) Add permissions to use Windows Azure Active Directory.

    enter image description here

    3) Grant permission for the app to use Active directory. enter image description here

    This sample does use a startup file, but it is not necessary to do it that way. You can create your own startup file though or just use the one in the sample.

    In addition, here is another example of an application using web forms, Azure AD, and OpenID Connect. http://www.cloudidentity.com/blog/2014/07/24/protecting-an-asp-net-webforms-app-with-openid-connect-and-azure-ad/

    This blog also has an entire tutorial for how to do this. https://devblogs.microsoft.com/premier-developer/convert-asp-net-webforms-with-windows-authentication-to-use-aad/

    Let me know if you have further questions!

    Please take a moment to "Mark as Answer" and/or "Vote as Helpful" wherever applicable. Thanks!

    Wednesday, November 13, 2019 8:03 PM
  • I am just following up on this request in case the information provided in the post helped. Please do mark it as answer in case the information provided helped you so that its relevancy increases and it helps people searching for similar queries . In case if you have any further queries on this , please do let us know and we will be happy to help . 

    Thank you. 

    Please take a moment to "Mark as Answer" and/or "Vote as Helpful" wherever applicable. Thanks!!

    Wednesday, November 20, 2019 3:01 PM
  • Please let us know if you were able to resolve the issue from the replies before. If you still have more questions please let us know with some additional information regarding your question and we'll try to resolve it. It may require additional support escalation if we are unable to resolve this on this msdn thread. 

    If there's no more follow ups in regards to this, I will be marking an answer as answer. If you feel your question has not been answered please let us know anymore pending asks and we can try to follow up accordingly. 


    - Frank H.

    Tuesday, November 26, 2019 8:07 PM
  • I'm following up on this please let us know if there are anymore questions. As it looks like this issue has been resolved within the scope of the MSDN Thread Question, I will be marking the response as answer. Please let me know if your question has not been answered, and I can go ahead and unmark it as answer or feel free to mark it as unanswer yourself. Also please remember to post future questions on the new Q&A Forums here : https://docs.microsoft.com/answers/index.html Thanks
    Wednesday, December 11, 2019 7:10 PM