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

來源:互聯網
上載者:User
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




聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.