使用"&放大器;放大器;"在web.config中的appSettings [英] using "&" in appSettings in web.config

查看:170
本文介绍了使用"&放大器;放大器;"在web.config中的appSettings的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图来存储网站地址在web.config文件的appSettings部分。该URL具有URL的端有两个查询字符串paramters,所以我需要使用&放大器;符号。当我辛苦code在code文件的URL,如果我替换它的工作原理&放大器;放大器;。在配置文件中这些字母是红色的。我都试过与&和&放大器;放大器;的配置,他们都变成红色,我无法从code文件阅读。谁能告诉我如何做到这一点,这样它的工作原理?

谢谢,

编辑:

它看起来像它不读从任何的appSettings。我用这条线来检索设置。

 字符串surveyLink = ConfigurationManager.AppSettings [SatisfactionSurveyLink];


解决方案

的问题是,我用的时候我应该已经用我的测试项目中的app.config文件Web.config文件

I'm trying to store a website address in the appSettings section of the web.config file. The URL has two querystring paramters at the end of the URL so I need to use the & symbol. When I hard code the URL in the code file it works if I substitute "&". In the config file these letters are red. I've tried both "&" and "&" in the config and they both turn red and I can't read them from the code file. Can anyone tell me how to do this so that it works?

Thanks,

EDIT:

It looks like it's not reading anything from the appSettings. I'm using this line to retrieve the setting.

String surveyLink = ConfigurationManager.AppSettings["SatisfactionSurveyLink"];

解决方案

The problem was that I was using a web.config file when I should have been using an app.config file in my test project

这篇关于使用"&放大器;放大器;"在web.config中的appSettings的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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