2018年4月7日土曜日

ASP.NET MVC クッキーの削除

// Cookie の削除
    protected void Button2_Click(object sender, EventArgs e)
    {
        // Cookie 削除例1
        Response.Cookies["userId"].Value = "UID0001";                  // Cookie の値
        Response.Cookies["userId"].Expires = DateTime.Now.AddDays(-3); // Cookie の有効期間(3日前)
 
        // Cookie 削除例2
        HttpCookie cookie = new HttpCookie("userName");
 
        cookie.Value = "<まさお>";               // Cookie の値
        cookie.Expires = DateTime.Now.AddDays(-3); // Cookie の有効期間(3日前)
        Response.Cookies.Add(cookie);
    }

2018年4月2日月曜日

Apache urlの大文字小文字を無視する設定

CentOS7 のhttpdの設定ファイル
 
 
/etc/httpd/conf/httpd.conf 
 
 
 
LoadModule speling_module modules/mod_speling.so

<Directory "/var/www/html/">
 <IfModule mod_speling.c>
  CheckSpelling On
 </IfModule>
</Directory>
 
 
 
httpdの再スタート

systemctl stop httpd.service
systemctl start httpd.service