mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-18 09:44:28 +08:00
去掉Owin的一些代码
This commit is contained in:
72
Infrastructure/Helper/CookieHelper.cs
Normal file
72
Infrastructure/Helper/CookieHelper.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
// ***********************************************************************
|
||||
// Assembly : Infrastructure
|
||||
// Author : Administrator
|
||||
// Created : 09-22-2015
|
||||
//
|
||||
// ***********************************************************************
|
||||
// <copyright file="CookieHelper.cs" company="">
|
||||
// Copyright (c) . All rights reserved.
|
||||
// </copyright>
|
||||
// <summary>Cookie辅助</summary>
|
||||
// ***********************************************************************
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
namespace Infrastructure.Helper
|
||||
{
|
||||
/// <summary>
|
||||
/// Cookie帮助类
|
||||
/// </summary>
|
||||
public class CookieHelper
|
||||
{
|
||||
/// <summary>
|
||||
/// 写cookie值
|
||||
/// </summary>
|
||||
/// <param name="strName">名称</param>
|
||||
/// <param name="strValue">值</param>
|
||||
public static void WriteCookie(string strName, string strValue)
|
||||
{
|
||||
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
|
||||
if (cookie == null)
|
||||
{
|
||||
cookie = new HttpCookie(strName);
|
||||
}
|
||||
cookie.Value = strValue;
|
||||
HttpContext.Current.Response.AppendCookie(cookie);
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 写cookie值
|
||||
/// </summary>
|
||||
/// <param name="strName">名称</param>
|
||||
/// <param name="strValue">值</param>
|
||||
/// <param name="strValue">过期时间(分钟)</param>
|
||||
public static void WriteCookie(string strName, string strValue, int expires)
|
||||
{
|
||||
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
|
||||
if (cookie == null)
|
||||
{
|
||||
cookie = new HttpCookie(strName);
|
||||
}
|
||||
cookie.Value = strValue;
|
||||
cookie.Expires = DateTime.Now.AddMinutes(expires);
|
||||
HttpContext.Current.Response.AppendCookie(cookie);
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 读cookie值
|
||||
/// </summary>
|
||||
/// <param name="strName">名称</param>
|
||||
/// <returns>cookie值</returns>
|
||||
public static string GetCookie(string strName)
|
||||
{
|
||||
if (HttpContext.Current.Request.Cookies[strName] != null)
|
||||
{
|
||||
return HttpContext.Current.Request.Cookies[strName].Value.ToString();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
55
Infrastructure/Infrastructure.csproj
Normal file
55
Infrastructure/Infrastructure.csproj
Normal file
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5FEAEC9A-4F1E-4EE7-B377-9DB1B0870DAC}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Infrastructure</RootNamespace>
|
||||
<AssemblyName>Infrastructure</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Helper\CookieHelper.cs" />
|
||||
<Compile Include="Helper\SessionHelper.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
36
Infrastructure/Properties/AssemblyInfo.cs
Normal file
36
Infrastructure/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("Infrastructure")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Infrastructure")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("e953a7ce-9f0c-4aec-973c-de31e38e10e6")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
Reference in New Issue
Block a user