add solution for session variables
This commit is contained in:
parent
e18253ce65
commit
132b32e9f5
|
@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
|||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26430.12
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2017-12-02_states", "2017-12-02_states\2017-12-02_states.csproj", "{3A1729B4-F3DA-4FF4-84C2-502F2DA2788C}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "2017j-12-02_states", "2017-12-02_states\2017j-12-02_states.csproj", "{3A1729B4-F3DA-4FF4-84C2-502F2DA2788C}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
|
@ -17,8 +17,8 @@
|
|||
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
|
||||
<UseIISExpress>true</UseIISExpress>
|
||||
<IISExpressSSLPort />
|
||||
<IISExpressAnonymousAuthentication />
|
||||
<IISExpressWindowsAuthentication />
|
||||
<IISExpressAnonymousAuthentication>disabled</IISExpressAnonymousAuthentication>
|
||||
<IISExpressWindowsAuthentication>enabled</IISExpressWindowsAuthentication>
|
||||
<IISExpressUseClassicPipelineMode />
|
||||
<UseGlobalApplicationHostFile />
|
||||
<NuGetPackageImportStamp>
|
||||
|
@ -70,6 +70,7 @@
|
|||
<Content Include="MasterPageExample.aspx" />
|
||||
<Content Include="packages.config" />
|
||||
<Content Include="Default.Master" />
|
||||
<Content Include="UserName.ascx" />
|
||||
<None Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</None>
|
||||
|
@ -130,6 +131,13 @@
|
|||
<Compile Include="SecondPage.aspx.designer.cs">
|
||||
<DependentUpon>SecondPage.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UserName.ascx.cs">
|
||||
<DependentUpon>UserName.ascx</DependentUpon>
|
||||
<SubType>ASPXCodeBehind</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UserName.ascx.designer.cs">
|
||||
<DependentUpon>UserName.ascx</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
|
@ -15,10 +15,10 @@
|
|||
<asp:TextBox ID="TextBoxValue2" runat="server"></asp:TextBox>
|
||||
<br />
|
||||
<br />
|
||||
<asp:RadioButton ID="RadioButtonSubtraction" runat="server" Text="Subtraction"/>
|
||||
<asp:RadioButton ID="RadioButtonSubtraction" GroupName="selection" runat="server" Text="Subtraction"/>
|
||||
<br />
|
||||
<br />
|
||||
<asp:RadioButton ID="RadioButtonAddition" runat="server" Text="Addition"/>
|
||||
<asp:RadioButton ID="RadioButtonAddition" GroupName="selection" runat="server" Text="Addition"/>
|
||||
<br />
|
||||
<br />
|
||||
<asp:Button ID="ButtonCalculate" runat="server" Text="Calculate" OnClick="ButtonCalculate_Click" />
|
||||
|
|
|
@ -12,7 +12,6 @@ namespace _2017_12_02_states
|
|||
protected void Page_Load(object sender, EventArgs e)
|
||||
|
||||
{
|
||||
|
||||
}
|
||||
protected void ButtonDefault_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
<%@ Page Title="" Language="C#" MasterPageFile="~/Default.Master" AutoEventWireup="true" CodeBehind="MasterPageExample.aspx.cs" Inherits="_2017_12_02_states.MasterPageExample" %>
|
||||
|
||||
<%@ Register Src="~/UserName.ascx" TagPrefix="uc1" TagName="UserName" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
|
||||
<uc1:UserName runat="server" id="UserName" />
|
||||
</asp:Content>
|
||||
|
|
|
@ -3,15 +3,22 @@
|
|||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace _2017_12_02_states
|
||||
{
|
||||
|
||||
|
||||
public partial class MasterPageExample
|
||||
{
|
||||
namespace _2017_12_02_states {
|
||||
|
||||
|
||||
public partial class MasterPageExample {
|
||||
|
||||
/// <summary>
|
||||
/// UserName control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::_2017_12_02_states.WebUserControl1 UserName;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="UserName.ascx.cs" Inherits="_2017_12_02_states.WebUserControl1" %>
|
||||
<asp:Label ID="LabelUsername" runat="server" Text="Label">
|
||||
</asp:Label>
|
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.UI;
|
||||
using System.Web.UI.WebControls;
|
||||
|
||||
namespace _2017_12_02_states
|
||||
{
|
||||
public partial class WebUserControl1 : System.Web.UI.UserControl
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (Session["Username"] == null)
|
||||
{
|
||||
Session["Username"] = HttpContext.Current.User.Identity.Name;
|
||||
}
|
||||
LabelUsername.Text = Session["Username"].ToString();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace _2017_12_02_states {
|
||||
|
||||
|
||||
public partial class WebUserControl1 {
|
||||
|
||||
/// <summary>
|
||||
/// LabelUsername control.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Auto-generated field.
|
||||
/// To modify move field declaration from designer file to code-behind file.
|
||||
/// </remarks>
|
||||
protected global::System.Web.UI.WebControls.Label LabelUsername;
|
||||
}
|
||||
}
|
Reference in New Issue