如何在Web.Config中提供IP地址作为DocumentsPath [英] How to provide a IP Address as DocumentsPath in Web.Config

查看:77
本文介绍了如何在Web.Config中提供IP地址作为DocumentsPath的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我在一个IP地址中只有几张图像,我需要在我的应用程序页面中显示该图像,因为我已经在我的web.config文件的DocumentsPaths中声明了Ip地址,但是我无法访问这些图像.请查看下面的代码我在我的web.config文件中提到的
< add key ="Documentspath" value ="http://192.168.0.88/syed sw/">
任何人都可以建议我提供正确的代码来访问web.config文件的DocumentsPath中的IP地址吗?



问候,
SARAVANA.M

Hi Friends,

I have few images in one IP address , i need to display that images in my application page for that i have declared that Ip Address in DocumentsPaths of my web.config file but i am not able access those images .Please look at the code below which i have mentioned in my web.config file ,
<add key="Documentspath" value="http://192.168.0.88/syed sw/">
Can any one suggest me to provide the correct code to access the Ip address in my DocumentsPath of web.config file ?



Regards,
SARAVANA.M

推荐答案

在web.config中的appsettings下再添加一个密钥例如:


under appsettings in your web.config add one more key Eg:


<add key="my_ip_address" value="192.168.10.1"/>




在您的代码中,您可以按以下方式使用此键




and in you code you can use this key as follows

string ip_path = System.Configuration.ConfigurationManager.AppSettings ["my_ip_address"].ToString();




这样,您就可以以字符串形式获取IP地址,并根据需要自定义它,这只是一个示例.


希望对您有所帮助.




This way you can get you ip address in a string, customize this as per your requirement, this is just an example.


I hope this will help you out.


这篇关于如何在Web.Config中提供IP地址作为DocumentsPath的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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