migrate to new git
This commit is contained in:
35
web/sites_test.aspx.cs
Normal file
35
web/sites_test.aspx.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
public partial class sites_test : System.Web.UI.Page
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
string site_id = HttpContext.Current.Request.Url.Host;
|
||||
var conn_config = ConfigurationManager.ConnectionStrings[site_id];
|
||||
|
||||
string title = Sites.sites.FirstOrDefault(q => q.url == site_id)?.title;
|
||||
|
||||
string conn_str = conn_config==null?"(N/A)": conn_config.ConnectionString;
|
||||
int n = 40;
|
||||
string conn_str_test = "(N/A)";
|
||||
if (conn_str.Length>n)
|
||||
{
|
||||
conn_str_test=conn_str.Substring(0, n) + "......" + conn_str.Right(n);
|
||||
}
|
||||
Label1.Text = site_id;
|
||||
Label4.Text = conn_str_test;
|
||||
}
|
||||
}
|
||||
public static class StringExtensions
|
||||
{
|
||||
public static string Right(this string str, int length)
|
||||
{
|
||||
return str.Substring(str.Length - length, length);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user