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

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值