1
Vote

ServerLogins.aspx Throw Exception

description

When I want to view logins on SQL Server 2000, the form throw an exception. The reason is a missing validation in the string properties of the class SqlLogin. I fix it replacing null string with String.Empty value.

file attachments

comments

Synchro wrote Aug 1, 2008 at 7:25 PM

I have encountered the same error. It seems to occur when no default database setting exists for the login. I recommend changing the code as follows:

At line 60 in ServerLogins.aspx.cs, replace:
            ds.Tables[0].Rows.Add(
                new object[] {
                    Server.HtmlEncode(login.Name), 
                    Server.HtmlEncode(login.LoginType.ToString()),
                    Server.HtmlEncode(login.NTLoginAccessType.ToString()),
                    Server.HtmlEncode(login.Database.ToString()),
                    Server.HtmlEncode(login.LanguageAlias.ToString()),}
with:
            ds.Tables[0].Rows.Add(
                new object[] {
                    Server.HtmlEncode(login.Name ?? ""), 
                    Server.HtmlEncode(login.LoginType.ToString()),
                    Server.HtmlEncode(login.NTLoginAccessType.ToString()),
                    Server.HtmlEncode(login.Database ?? ""),
                    Server.HtmlEncode(login.LanguageAlias ?? ""),}