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. Exception thrown

Exception thrown

Scheduled Pinned Locked Moved ASP.NET
designsecurityworkspacedata-structurestesting
6 Posts 5 Posters 0 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.
  • M Offline
    M Offline
    MaheshSharma
    wrote on last edited by
    #1

    using System; using System.Configuration; using System.Web.UI.WebControls; using System.Security.Principal; using System.Xml; using Itools.Encryption; using System.Web; using System.Text; using System.Text.RegularExpressions; namespace Ashwin.DAL { /// <summary> /// Summary description for Util /// </summary> public class Util { //Design users //adriaanse.a //allinsmith.w private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"] private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M="; private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ=="; private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings; private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings; /// <summary> /// Returns the username without the domain of the current logged in user. /// </summary> /// <param name="User">Current logged in user, example CN\ashwin.k</param> /// <returns>Returns the username without the domain of the current logged in user. </returns> public static string GetSimpleUsername(IPrincipal User) { //setup user array to split username into domain and username #if DEBUG return whoami; #endif string[] user; // define which character is seperating fields char[] splitter = { '\\' }; //perform split user = User.Identity.Name.Split(splitter); //check to see if no domain exists for user if (user.Length < 2) { return user[0]; } else { return user[1]; } } /// <summary> /// Method to make sure that user's inputs are not malicious /// </summary> /// <param name="text">User's Input</param> /// <param name="maxLength">Maximum length of input</param> /// <returns>The cleaned up version of the input</returns> public static string InputText(string text, int maxLength) { text = text.Trim(); if (string.IsNullOrEmpty(text)) return string.Empty; if (text.Length > maxLength) text = text.Substring(0, maxLeng

    J N S D 4 Replies Last reply
    0
    • M MaheshSharma

      using System; using System.Configuration; using System.Web.UI.WebControls; using System.Security.Principal; using System.Xml; using Itools.Encryption; using System.Web; using System.Text; using System.Text.RegularExpressions; namespace Ashwin.DAL { /// <summary> /// Summary description for Util /// </summary> public class Util { //Design users //adriaanse.a //allinsmith.w private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"] private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M="; private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ=="; private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings; private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings; /// <summary> /// Returns the username without the domain of the current logged in user. /// </summary> /// <param name="User">Current logged in user, example CN\ashwin.k</param> /// <returns>Returns the username without the domain of the current logged in user. </returns> public static string GetSimpleUsername(IPrincipal User) { //setup user array to split username into domain and username #if DEBUG return whoami; #endif string[] user; // define which character is seperating fields char[] splitter = { '\\' }; //perform split user = User.Identity.Name.Split(splitter); //check to see if no domain exists for user if (user.Length < 2) { return user[0]; } else { return user[1]; } } /// <summary> /// Method to make sure that user's inputs are not malicious /// </summary> /// <param name="text">User's Input</param> /// <param name="maxLength">Maximum length of input</param> /// <returns>The cleaned up version of the input</returns> public static string InputText(string text, int maxLength) { text = text.Trim(); if (string.IsNullOrEmpty(text)) return string.Empty; if (text.Length > maxLength) text = text.Substring(0, maxLeng

      J Offline
      J Offline
      JHizzle
      wrote on last edited by
      #2

      Could you sling that into a code block please, and tell us which line the exception is being thrown at as well as what the exception message says.

      1 Reply Last reply
      0
      • M MaheshSharma

        using System; using System.Configuration; using System.Web.UI.WebControls; using System.Security.Principal; using System.Xml; using Itools.Encryption; using System.Web; using System.Text; using System.Text.RegularExpressions; namespace Ashwin.DAL { /// <summary> /// Summary description for Util /// </summary> public class Util { //Design users //adriaanse.a //allinsmith.w private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"] private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M="; private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ=="; private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings; private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings; /// <summary> /// Returns the username without the domain of the current logged in user. /// </summary> /// <param name="User">Current logged in user, example CN\ashwin.k</param> /// <returns>Returns the username without the domain of the current logged in user. </returns> public static string GetSimpleUsername(IPrincipal User) { //setup user array to split username into domain and username #if DEBUG return whoami; #endif string[] user; // define which character is seperating fields char[] splitter = { '\\' }; //perform split user = User.Identity.Name.Split(splitter); //check to see if no domain exists for user if (user.Length < 2) { return user[0]; } else { return user[1]; } } /// <summary> /// Method to make sure that user's inputs are not malicious /// </summary> /// <param name="text">User's Input</param> /// <param name="maxLength">Maximum length of input</param> /// <returns>The cleaned up version of the input</returns> public static string InputText(string text, int maxLength) { text = text.Trim(); if (string.IsNullOrEmpty(text)) return string.Empty; if (text.Length > maxLength) text = text.Substring(0, maxLeng

        N Offline
        N Offline
        Not Active
        wrote on last edited by
        #3

        No one is going to read this unformatted drivel. Please format any code, as per CP guidelines, and only include what is relevant. And no, not all of this is relevant to your issue.


        I know the language. I've read a book. - _Madmatt

        1 Reply Last reply
        0
        • M MaheshSharma

          using System; using System.Configuration; using System.Web.UI.WebControls; using System.Security.Principal; using System.Xml; using Itools.Encryption; using System.Web; using System.Text; using System.Text.RegularExpressions; namespace Ashwin.DAL { /// <summary> /// Summary description for Util /// </summary> public class Util { //Design users //adriaanse.a //allinsmith.w private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"] private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M="; private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ=="; private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings; private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings; /// <summary> /// Returns the username without the domain of the current logged in user. /// </summary> /// <param name="User">Current logged in user, example CN\ashwin.k</param> /// <returns>Returns the username without the domain of the current logged in user. </returns> public static string GetSimpleUsername(IPrincipal User) { //setup user array to split username into domain and username #if DEBUG return whoami; #endif string[] user; // define which character is seperating fields char[] splitter = { '\\' }; //perform split user = User.Identity.Name.Split(splitter); //check to see if no domain exists for user if (user.Length < 2) { return user[0]; } else { return user[1]; } } /// <summary> /// Method to make sure that user's inputs are not malicious /// </summary> /// <param name="text">User's Input</param> /// <param name="maxLength">Maximum length of input</param> /// <returns>The cleaned up version of the input</returns> public static string InputText(string text, int maxLength) { text = text.Trim(); if (string.IsNullOrEmpty(text)) return string.Empty; if (text.Length > maxLength) text = text.Substring(0, maxLeng

          S Offline
          S Offline
          Sandesh M Patil
          wrote on last edited by
          #4

          Enter your code between "code block" :)

          1 Reply Last reply
          0
          • M MaheshSharma

            using System; using System.Configuration; using System.Web.UI.WebControls; using System.Security.Principal; using System.Xml; using Itools.Encryption; using System.Web; using System.Text; using System.Text.RegularExpressions; namespace Ashwin.DAL { /// <summary> /// Summary description for Util /// </summary> public class Util { //Design users //adriaanse.a //allinsmith.w private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"] private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M="; private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ=="; private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings; private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings; /// <summary> /// Returns the username without the domain of the current logged in user. /// </summary> /// <param name="User">Current logged in user, example CN\ashwin.k</param> /// <returns>Returns the username without the domain of the current logged in user. </returns> public static string GetSimpleUsername(IPrincipal User) { //setup user array to split username into domain and username #if DEBUG return whoami; #endif string[] user; // define which character is seperating fields char[] splitter = { '\\' }; //perform split user = User.Identity.Name.Split(splitter); //check to see if no domain exists for user if (user.Length < 2) { return user[0]; } else { return user[1]; } } /// <summary> /// Method to make sure that user's inputs are not malicious /// </summary> /// <param name="text">User's Input</param> /// <param name="maxLength">Maximum length of input</param> /// <returns>The cleaned up version of the input</returns> public static string InputText(string text, int maxLength) { text = text.Trim(); if (string.IsNullOrEmpty(text)) return string.Empty; if (text.Length > maxLength) text = text.Substring(0, maxLeng

            D Offline
            D Offline
            daveyerwin
            wrote on last edited by
            #5

            using System;
            using System.Configuration;
            using System.Web.UI.WebControls;
            using System.Security.Principal;
            using System.Xml;
            using Itools.Encryption;
            using System.Web;
            using System.Text;
            using System.Text.RegularExpressions;

            namespace Ashwin.DAL
            {
            /// <summary>
            /// Summary description for Util
            /// </summary>
            public class Util
            {
            //Design users
            //adriaanse.a
            //allinsmith.w
            private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"]
            private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M=";
            private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ==";
            private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings;
            private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings;

                /// <summary>
                /// Returns the username without the domain of the current logged in user. 
                /// </summary>
                /// <param name="User">Current logged in user, example CN\\ashwin.k</param>
                /// <returns>Returns the username without the domain of the current logged in user. </returns>
                public static string GetSimpleUsername(IPrincipal User)
                {
                    //setup user array to split username into domain and username
            

            #if DEBUG
            return whoami;
            #endif
            string[] user;

                    // define which character is seperating fields
                    char\[\] splitter = { '\\\\' };
            
                    //perform split
                    user = User.Identity.Name.Split(splitter);
            
            
                    //check to see if no domain exists for user
                    if (user.Length < 2)
                    {
                        return user\[0\];
                    }
                    else
                    {
                        return user\[1\];
            
                    }
                }
            
                /// <summary>
                /// Method to make sure that user's inputs are not malicious
                /// </summary>
                /// <param name="text">User's Input</param>
                /// <param name="maxLength">Maximum length of input</param>
                /// <returns>The cleaned up version of the input</returns>
                public static string InputText(string text, int maxLength)
                {
                    text = text.Trim();
                    if (string.IsNullOrEmpty(text))
                        return string.Empty;
                    if (text.Length > maxLen
            
            N 1 Reply Last reply
            0
            • D daveyerwin

              using System;
              using System.Configuration;
              using System.Web.UI.WebControls;
              using System.Security.Principal;
              using System.Xml;
              using Itools.Encryption;
              using System.Web;
              using System.Text;
              using System.Text.RegularExpressions;

              namespace Ashwin.DAL
              {
              /// <summary>
              /// Summary description for Util
              /// </summary>
              public class Util
              {
              //Design users
              //adriaanse.a
              //allinsmith.w
              private static readonly string whoami = "ashwin.k";//For testing - for cop ["westring.bd"]
              private const string encKey = "KFn2oZAwJHWFRbSXoaSlYjl5TADpyyt53rowhbVwH/M=";
              private const string encVector = "nb2dZEGWnzg8R1GZAuUkUQ==";
              private static System.Collections.ICollection appSettings = ConfigurationManager.AppSettings;
              private static System.Configuration.ConnectionStringSettingsCollection connStrings = ConfigurationManager.ConnectionStrings;

                  /// <summary>
                  /// Returns the username without the domain of the current logged in user. 
                  /// </summary>
                  /// <param name="User">Current logged in user, example CN\\ashwin.k</param>
                  /// <returns>Returns the username without the domain of the current logged in user. </returns>
                  public static string GetSimpleUsername(IPrincipal User)
                  {
                      //setup user array to split username into domain and username
              

              #if DEBUG
              return whoami;
              #endif
              string[] user;

                      // define which character is seperating fields
                      char\[\] splitter = { '\\\\' };
              
                      //perform split
                      user = User.Identity.Name.Split(splitter);
              
              
                      //check to see if no domain exists for user
                      if (user.Length < 2)
                      {
                          return user\[0\];
                      }
                      else
                      {
                          return user\[1\];
              
                      }
                  }
              
                  /// <summary>
                  /// Method to make sure that user's inputs are not malicious
                  /// </summary>
                  /// <param name="text">User's Input</param>
                  /// <param name="maxLength">Maximum length of input</param>
                  /// <returns>The cleaned up version of the input</returns>
                  public static string InputText(string text, int maxLength)
                  {
                      text = text.Trim();
                      if (string.IsNullOrEmpty(text))
                          return string.Empty;
                      if (text.Length > maxLen
              
              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              Why? You have done nothing to help the OP learn the proper etiquette here. You have also added more useless space to the forum since not all of this code directly pertains to the question.


              I know the language. I've read a book. - _Madmatt

              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