Sp. Net 2.0133 classic learning objective 2.txt

Source: Internet
Author: User

<System. Web>
<Httpmodules>
<Add name = "page" type = "ns. Class"> </Add>
</Httpmodules>
</System. Web>

Namwspace NS
{
Class class: ihttpmodule
{
Public void dispose: ihttpmodule. Dispose
{

}

Public void Init (httpapplication xontext): ihttpmodule. init
{

}

}

}
----------------------------------------------------------------
<Sessionstate mode = "off"/> disable session Status
<Pages enablesessionstate = "readonly"/> set the session status to read-only.
Compilation cache is intermediateCodeOn disk
----------------------------------------------------------
The output cache caches the entire page.
<% @ Outputcache duration = "30" varybyparam = "NONE" %>
The outputcache Command tells ASP/net that once the page output has been created, it will be stored in the cache
The varybyparam attribute indicates whether the external impact will affect how the page is cached. None indicates that the page is not affected and only one copy is cached. type indicates that the page is cached for each different value of the variable.

Copy
Fragment Cache
<% @ Control outputcache duration = "30" varybyparam = "NONE" %> only cache User Controls

Cache replacement

<% @ Outputcache duration = "30" varybyparam = "NONE" %>
<Asp: substitution id = "sub1" runat = "server" methodname = "sub"/>
Methodname indicates a function that returns a data string replaced by the cached page.
---------------------
Use stored procedures
<Asp: sqldatasource>
Connectionstring = <% $ connectionstrings: DD %>
Selectedcommand = "prodd"
Selectedcommandtype = "storedprocedure"
</ASP: sqldatasource>
---------------------------------------------------------
Protected void bt_click (Object sender, eventargs E)
{
// Update the configuration file profile. Name = (textbox) dd. fincontol [""]. Text
// The server. transfer method runs the code server. Transfer (sitemap. currentnode. url) on the page specified by the request)
// The server. Transfer Method stops the execution of the current page and runs the content on the specified page. In this case, you want to load the current page again to refresh the current attempt of the page
}
Protected void logicview_viewchanged (Object sender, eventargs E)
{
// Update the configuration file attributes
}

 

<Asp: loginview id = "logicview" runat = "server" onviewchanged = "logicview_viewchanged">
<Loggedintemplate>
You are logged in
</Loggedintemplate>
<Rolegroups>
<Asp: rolegroup roles = "General Manager">
<Contenttemplate>
<P> fffff General Manager role page </P>
Hao rolegroup
<P> <asp: button id = "BT" runat = "server" text = "BT" onclick = "bt_click"/> </P>
</Contenttemplate>
</ASP: rolegroup>
<Asp: rolegroup roles = "employee">
<Contenttemplate>
Page displayed by the employee
</Contenttemplate>
</ASP: rolegroup>
<Asp: rolegroup roles = "department director">
<Contenttemplate>
What the department supervisor sees
</Contenttemplate>
</ASP: rolegroup>
</Rolegroups>
<Anonymoustemplate>
You are not logged
<Span> djklasjgkljglrekj </span>
</Anonymoustemplate>

</ASP: loginview>

<System. Web>
<Profile enabled = "true">
<Properties>
<Add name = "userid" type = "system. boolean"> </Add>
<! --
It can also be a custom type
<Add name = "cart" serializaas = "binary" type = "wrox. Commerce. shoopingcart" allowanonymous = "true"/>
Use profile. Name = "Chris Hart" on the page"
-->
</Properties>

</Profile>

</System. Web>

<Location Path = "default. aspx">

<System. Web>

<Authorization>
<Allow roles = "employee"/>
</Authorization>
<! -- If you add
<Sitemapnode url = "text/default. aspx" roles = "employee, Department Head">
This allows the Department Supervisor to see the connection but cannot access the connection.
Indicates that the authorization priority in Web. config is high.
The isinrole () method is used to use a role in code.
Public readonly double Member
{
Get {
If (httpcontext. Current. User. isinrole ("employee ")
{
Return subtotal * FF
String S = string. Format ("Sub: {0, 35: c}", ddvar );

}
Else {
Return 0;
}
}

}
Httpcontext. Current. User. isinrole ("employee") Call
First use
Next time, you only need to use context. User. isinrole ("employee ")
There are differences between the two calls
-->
</System. Web>
</Location>

<Location Path = "test2.aspx">
<! --
Suppose Test2 is a folder, you can connect to itself
Role controls folders.
-->
<System. Web>






Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.