希望将一些信息放在asp.net mvc3的中心位置 [英] Want to put some information at central place in asp.net mvc3

查看:81
本文介绍了希望将一些信息放在asp.net mvc3的中心位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在asp.net mvc3上有一个运行良好的应用程序,现在我想要
用不同的名字来克隆那个网站,我想把所有的都放
一处收集信息,以便我在一处更改,并且全部更改
在网站上就像我要更改一样

网站名称
网站口号
网站徽标
网站徽标(小)

我如何在asp.net mvc3中执行此操作.在此先谢谢您

i have a application on asp.net mvc3 working perfectly , now i want
to make clone of that site with different name and i want put all that
information at one place so that i change on one place and it changes all
over the site like if i want to change

Site Name
Site Slogan
Site Logo
Site Logo ( Small )

how can i do this in asp.net mvc3 . Thanks in advance

推荐答案

您可以使用Web配置来存储自定义设置,您只需要从Web配置中加载动态值(就像我们将连接字符串存储在Web中一样) .config).

您只需使用其他站点名称复制并粘贴已发布的版本,只需要更改Web配置,并确保应用程序中的所有图像均可用

Hi You can use web config to store custom setting, you have to load the dynamic value from webconfig only(like we are store connection string in web.config).

You can just copy and past your published version with different site name only you need change web config, make sure all images available in your application

<appsettings>
   <add key="SiteName" value="test" />
   <add key="SiteSlogan" value="test" />
   <add key="SiteLogo" value="imagepath" />
<add key="SiteLogoSmall" value="imagepath" />
</appsettings>



读取Web配置值:



to read the web config value:

ConfigurationSettings.AppSettings.Get("SiteName")



添加参考文献:
System.Configuration



add reference of :
System.Configuration


这篇关于希望将一些信息放在asp.net mvc3的中心位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆