Попробуйте это:
using System;
using System.Configuration;
using System.Web.Configuration;
namespace SampleApplication.WebConfig
{
public partial class webConfigFile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//Helps to open the Root level web.config file.
Configuration webConfigApp = WebConfigurationManager.OpenWebConfiguration("~");
//Modifying the AppKey from AppValue to AppValue1
webConfigApp.AppSettings.Settings["ConnectionString"].Value = "ConnectionString";
//Save the Modified settings of AppSettings.
webConfigApp.Save();
}
}
}
Я все равно собирался опубликовать ответ ... итак:
get '/' do
"Your IP address is #{ @env['REMOTE_ADDR'] }"
end
Sinatra использует Rack :: Request API , поэтому вы можете использовать множество доступных в нем вещей.
Также ссылка на Sinatra документ .