Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
Node is saved as draft in My Content >> Draft
  • Putting reused things in common file

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 50
    Comment on it

    In .NET while working with projects you need to write some line of code again and again which may contain crucial information like your mail settings your connection strings

    Instead of writing that, again and again, you need to wrap it in a single file.

     

    Public NotInheritable Class KnownConstants
    
        Public Shared DBConnectionString As String = "DBConnectionString"
        Public Const LogFilePath As String = "~/Common/LogFile.txt"
        Public Shared InformationLog As String = "Information log"
        Public Shared ErrorLog As String = "Error log"
        Public Shared UnauthorizedMessage As String = "Unauthorized access."
        Public Shared InvalidRequest As String = "Invalid request."
        Public Shared BaseAddress As String = ConfigurationManager.AppSettings("BaseAddress").ToString()
        Public Shared ProfileImageBaseAddress As String = ConfigurationManager.AppSettings("ProfileImageBaseAddress").ToString()
        Public Shared DefaultProfileImage As String = ConfigurationManager.AppSettings("DefaultProfileImage").ToString()
    
        Public Shared SenderEmailID As String = ConfigurationManager.AppSettings("SenderEmailID").ToString()
        Public Shared SenderPassword As String = ConfigurationManager.AppSettings("SenderPassword").ToString()
        Public Shared SenderAddress As String = ConfigurationManager.AppSettings("SenderAddress").ToString()
    
        Public Shared DisplayName As String = ConfigurationManager.AppSettings("DisplayName").ToString()
        Public Shared EnableSSl As String = ConfigurationManager.AppSettings("EnableSSl").ToString()
    
        Public Shared Host As String = ConfigurationManager.AppSettings("Host").ToString()
        Public Shared Port As String = ConfigurationManager.AppSettings("Port").ToString()
    
        Public Shared PasswordResetSubject As String = ConfigurationManager.AppSettings("PasswordResetSubject").ToString()
        Public Shared ForgotPasswordLength As String = ConfigurationManager.AppSettings("ForgotPasswordLength").ToString()
    End Class

     

    This file contains all the things that needs to be used in the project

    .net

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: