ASP.NET Core and Windows Authentication

Just a reminder of how to configure ASP.NET Core and Windows Authentication

1. Configure IIS

2. Go to properties folder, file launchSettings.json and modify

"iisSettings": {     "windowsAuthentication": true,     "anonymousAuthentication": false,    //other data

3. When you compile and run , the Web.Config will be modified for forwardWindowsAuthToken :

<aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" forwardWindowsAuthToken="true" stdoutLogEnabled="false" />

spot errors in VB

Please spot the errors in the following code in VB.NET:

Dim Diff As String = con.ExecuteCommand(“SELECT DATEDIFF(Day, (select [date] from table where Username = ‘” + txtUserName.Text + “‘), ‘” & DateTime.Now.ToString() & “‘)”)
If (Diff > 30) Then
Response.Redirect(“PleaseChangeMyPassword.aspx”)
End If

 

( find at least 3…)

Side note:

No wonder Visual Basic has died ( more or less). Guess future of server javascript ….

Generating Visual Studio solution( or project) references

A Visual Studio pacakge is a plugin of Visual Studio that can do (almost) anything inside Visual Studio

I have made a small project that generates a list of all solution ( or project) references from VS:

 

            foreach (var project in dte.Solution.Projects)
            {
                var p = project as Project;
                if (p == null)
                {
                    continue;
                }

                var vsproject = p.Object as VSLangProj.VSProject;
                if (vsproject == null)
                    continue;

                string nameProject = p.Name;
                foreach (var reference in vsproject.References)
                {
                    var r = reference as Reference;
                    if (r == null)
                        continue;

                    var pathRef = r.Path;

                    //this is a package                    
                    var pa = new PackageAdd();
                  
                    pa.ProjectName = p.Name;
                    pa.IdentifierPackage = r.Identity;
                    pa.VersionPackage = r.Version;
                    pa.NamePackage = r.Name;

                  



                    if (r.SourceProject != null)
                    {
                        
                        pa.NamePackage = r.SourceProject.Name;
                    }
                    sb.AppendLine(pa.ToString());
                }
            }

You can find the solution at https://github.com/ignatandrei/ToolsAndUtilities/tree/master/VS2015/FindReferencesVS

Also the video is at https://youtu.be/a3YHVjJ9fm4

Enjoy!

Thank you for all the API

In our days it is simpler to make an application by putting together some API . I wanted to make a list of all my 5 Minutes .NET playlist videos . First, I have tried to find an application(nothing). Then I have read  You Tube API from https://console.developers.google.com/apis/library . With 2 http requests( one for retrieving all videos from a playlist, the other to find video details) and a NuGet package to export to Excel/Word/PDF/HTML it was simple. You can find the whole project at https://github.com/ignatandrei/YouTube . A video demo at https://www.youtube.com/watch?v=wNHDsHtLBq4 . And the whole list at https://github.com/ignatandrei/ToolsAndUtilities/tree/gh-pages