Localization/MasterPage in ASP.NET 1.1 with Spring.Net

80酷酷网    80kuku.com

  asp.net|erp 

1. Get spring.core/spring.web from sourceforge's CVS

2.Include Spring.Core,Spring.Web in your new Web App

3.Change your Web.Config like:

<configuration>
    <configSections>
        <sectionGroup name="spring">
            <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
        </sectionGroup>
    </configSections>

    <spring>
        <context type="Spring.Context.Support.WebApplicationContext, Spring.Web">
            <resource uri="~/spring-objects.xml"/>
        </context>
    </spring> 
  
  <system.web>

   <httpHandlers>
        <add verb="*" path="*.aspx" type="Spring.Web.Support.PageHandlerFactory, Spring.Web"/>
    </httpHandlers>

    //.....default web.config begin.....
    <compilation     defaultLanguage="c#"     debug="true"   />
     .....

4.In the root, add a file: spring-objects.xml (defined in web.config <context type>...). like:
<?xml version="1.0" encoding="utf-8" ?>
 <objects>
<object id="masterPage" type="~/Master.aspx" />
  <object id="basePage" abstract="true">
      <property name="Master">
          <ref object="masterPage"/>
      </property>
  </object>
  <object id="Default" type="Default.aspx" parent="basePage" />

  <object id=THE_FILE_NAME type=THE_FULL_NAME />

  <object id="messageSource" type="Spring.Context.Support.ResourceSetMessageSource, Spring.Core">
        <property name="ResourceManagers">
            <list>
                <value>SpringNet.Web.UI.Head, SpringNet.Web.UI</value>
                <value>YOUR_WEB_FORM_WITH_DIR_NAME,YOUR_ASSEMBLY</value>
            </list>
        </property>   
    </object>
</objects>

5.add a asp:label in your default.aspx, named Label1;

6. chang in Default.aspx.cs:
public class Default:System.web.UI.Page => public class Default: Spring.Web.UI.Page

7.add in your resource files: Label1.Text = CHANG_TO_LOCALIZED_TEXT

8. Then, your are at the END:
files you need:
\Web.config
\spring-objects.xml
\Default..zh-CN.resx
\Default.en-US.resx
\Default.aspx.resx
\Default.aspx.cs
\Default.aspx


分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: