0% found this document useful (0 votes)
118 views2 pages

Cheat Sheet:: Markup and Code in A Single File

Contains assemblies used by the web application. App_Code C# or VB source code that is common to the web site. Utility classes, modules BasePages etc. Contains.skin,.css and image files used for the themes of the site.

Uploaded by

ElbinHasić
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
118 views2 pages

Cheat Sheet:: Markup and Code in A Single File

Contains assemblies used by the web application. App_Code C# or VB source code that is common to the web site. Utility classes, modules BasePages etc. Contains.skin,.css and image files used for the themes of the site.

Uploaded by

ElbinHasić
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Visual Web Developer 2005 Express Edition

Cheat Sheet : ASP.NET Basics


ASP.NET Special Folders

Markup and Code in a Single File

Bin Contains assemblies used by the web application


App_Code C# or VB source code that is common to the web site.
Utility classes, modules BasePages etc.
App_Data SQLExpress databases used by the web site.
App_GlobalResources Resources shared across all pages and controls.
App_LocalResources Resources specic to a page or control
App_WebReferences References to web services
App_Themes Contains .skin, .css and image les used for the themes of the site.

Markup and Code in Separate Files. "code behind model"


<%@ Page Language="C#" ClassName="Page1_aspx" Inherits="Page1" CodeFile="Page1.aspx.cs" %>

App_Browsers Optional .browser capabilities les.

Common Page and Control Directives


<%@
<%@
<%@
<%@

Page
Page
Page
Page

Language="C#"
Language="VB"
Language="C#"
Language="VB"

<%@
<%@
<%@
<%@

Control
Control
Control
Control

%>
%>
CodeFile="Page1.ascx.cs" Inherits="Control1" %>
CodeFile="Page1.ascx.vb" Inherits="Control1" %>

Language="C#"
Language="VB"
Language="C#"
Language="VB"

%>
%>
CodeFile="Page1.ascx.cs" Inherits="Control1" %>
CodeFile="Page1.ascx.vb" Inherits="Control1" %>

<%@ Register TagPrex="uc1" TagName="Control1" Src="Control1.ascx" %>


<%@ Register TagPrex="lvs" Namespace="Lvs.Web.UI" Assembly="Lvs.Web" %>
<%@ Import Namespace="System.Data" %>
<%@ OutputCache Duration="60" VaryByParam="none" %>
<%@ OutputCache Location="Server" VaryByParam="param1;param2" Duration="60" %>
<%@ OutputCache Location="None" NoStore="true" %>

Resources

Code Blocks
Inline code block
Inline render block

<% Response.Write("Hello World"); %>

Strings.es-MX.resx

<%= string.Format("2+2={0}", 2+2); %>

Data binding
expression block

<%# Container.ItemIndex %>

Expression block

<%$ Resources:String, Hello %>

Page level code. Methods,


properties, variable and
event handlers.

Strings.resx

<script runat="server"></script>

www.LearnVisualStudio.NET

Copyright 2006, LearnVisualStudio.NET

protected void Page_Load(object sender, EventArgs e)


{
Label1.Text=Resources.Strings.Hello;
}
<asp:Label ID="Label1" Text="<%$ Resources:Strings, Hello %>" runat="server" />

Default.aspx.resx

Default.aspx.es-MX.resx

<asp:Label ID="Label2" meta:resourceskey="HelloLabel" runat="server" />

Visual Web Developer 2005 Express Edition

Cheat Sheet : Common Web.cong Settings


App Settings

<appSettings>
<add key="MyKey" value="MyValue" />
</appSettings>

Connection Strings

<connectionStrings>
<add
name="LocalSqlServer"
connectionString="
data source=.\SQLEXPRESS;
Integrated Security=SSPI;
AttachDBFilename=|DataDirectory|aspnetdb.mdf;
User Instance=true"
providerName="System.Data.SqlClient"
/>
</connectionStrings>

Authentication

<authentication mode="Windows" />


<authentication mode="Forms">
<forms
loginUrl="Login.aspx"
defautUrl="Page1.aspx"
cookieless="AutoDetect"
domain="mydomain.com"
requireSSL="true"
/>
</authentication>

Authorization

<authorization>
<!-- Deny anonymous users -->
<deny users="?" />
<!-- Allow all authed users -->
<allow users="*" />
<!-- Allow admin role -->
<allow roles="Admin" />
</authorization>

www.LearnVisualStudio.NET

Copyright 2006, LearnVisualStudio.NET

Custom Error Pages

<customeErrors mode="RemoteOnly"
<customeErrors defaultRedirect="MyErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>

Default Settings for Pages

<pages
theme="MyTheme"
styleSheetTheme="MyTheme"
autoEventWireup="true"
masterPageFile="MyMaster"
pageBaseType="MyBasePage"
userControlBaseType="MyBaseControl"
>
<controls>
<add tagPrex="uc"
<add tagName="MyControl"
<add src="~/Controls/MyControl1.ascx" />
<add tagPrex="pfx"
<add tagName="MyAssembly"
<add src="My.Namespace" />
</controls>
<namespaces>
<add namespace="System.Text" />
</namespaces>
</pages>

Providers

<membership>
<providers>
<clear />
<add
name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider,
type="System.Web,
type="Version=2.0.0.0,
type="Culture-neutral,
type="PublicKeyToken=b03f5f7f11d50a3a"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="true"
applicationName="/"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempt="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="1"
passwordAttemptWindow="10"
passwordStrengthRegularExpression=""
/>
</providers>
</membership>

<prole>
<providers>
<clear />
<add
name="AspNetSqlProleProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
type="System.Web.Prole.SqlProleProvider,
type"=System.Web,
type"=Version=2.0.0.0,
type"=Culture-neutral,
type="PublicKeyToken=b03f5f7f11d50a3a"
</providers>
</prole>
<roleManager>
<providers>
<clear />
<add
name="AspNetSqlRoleProvider"
connectionStringName="LocalSqlServer"
applicationName="/"
type="System.Web.Prole.SqlRoleProvider,
type="System.Web,
type="Version=2.0.0.0,
type="Culture-neutral,
type="PublicKeyToken=b03f5f7f11d50a3a"
</providers>
</roleManager>

You might also like