Skip to content

How to change domain name dynamically using cs file

Phaneendra Chakravaram

Phaneendra Chakravaram

Asked Oct 30, 2017, 8:00 PM EDT1 answer
Share
LinkedInX
hi can you please tell me how to change domain name dynamically. if my domai is ex:"https://tstinginfo.com" how can i change dynamically .. after some days i want to change agin domain name numberof different domains how can i change dynamically ? whenever i want to change domain name i want to change dynamically..please reply as early as possible

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Deepak Khare
    0
    C#
    // Bind to the root hierarchy of log4net
    log4net.Repository.Hierarchy.Hierarchy root =
      log4net.LogManager.GetRepository()
        as log4net.Repository.Hierarchy.Hierarchy;
    
    if (root != null)
    {
      // Bind to the RollingFileAppender
    log4net.Appender.RollingFileAppender rfa =
    C#
        (log4net.Appender.RollingFileAppender)root.Root.GetAppender("RollingLogFileAppender");
    
      if (rfa != null)
      {
        // Set the file name based on the assembly name
        string filePath =
          string.Format("~/App_Data/{0}.log", GetType().Assembly.GetName().Name);
    
        // Assign the value to the appender
        rfa.File = Server.MapPath(filePath);
    
        // Apply changes to the appender
        rfa.ActivateOptions();
      }
    }
    0