hi all
i am using a windows application as well as web application developed in visual studio 2010 beta 2 using .net framework 4 on windows xp/windows server 2008/windows7
i am able to read web.config file on system running windows XP sp2 but same is not read by windows 7 and windows server 2008
i installed my web application on iis 7 on said windows with .net 4 but it not read web.config by my windows application.
i used below code on form_load in windows application for reading that web.config-
below is my web.config exist in c:\inetpub\wwwr oot\site\ folder -
the error comes in reading this is -
and below is the full exception path-
I hope anyone has the answer for me
i have to install it by two day so please help me
thanks in advanced
i am using a windows application as well as web application developed in visual studio 2010 beta 2 using .net framework 4 on windows xp/windows server 2008/windows7
i am able to read web.config file on system running windows XP sp2 but same is not read by windows 7 and windows server 2008
i installed my web application on iis 7 on said windows with .net 4 but it not read web.config by my windows application.
i used below code on form_load in windows application for reading that web.config-
Code:
Dim webStr As Configuration.Configuration=WebConfigurationManager.OpenWebConfiguration("/Site/")
Dim webConstr As String = webStr.ConnectionStrings.ConnectionStrings("connStr").ConnectionString
Dim getIdx As Integer = webConstr.IndexOf("User ID=", 0)
getIdx += 8
Dim getIdx2 As Integer = webConstr.IndexOf(";", getIdx)
Dim strLen As Integer = getIdx2 - getIdx
sqlUid = webConstr.Substring(getIdx, strLen)
Code:
<?xml version="1.0"?> <configuration> <connectionStrings> <remove name="LocalSqlServer"/> <add name="LocalSqlServer" connectionString="Data Source=myMacine;Initial Catalog=ASPNETDB;Persist Security Info=True;integrated security=true" providerName="System.Data.SqlClient"/> <add name="connStr" connectionString="Data Source=myMachine;Initial Catalog=abc;Persist Security Info=True;User ID=xyz;" providerName="System.Data.SqlClient"/> </connectionStrings> ....... ...... </configuration>
Code:
Failed to map the path '/site'
Code:
at System.Web.Configuration.ProcessHostConfigUtils.MapPathActual(String siteName, VirtualPath path) at System.Web.Configuration.ProcessHostMapPath.MapPathCaching(String siteID, VirtualPath path) at System.Web.Configuration.ProcessHostMapPath.System.Web.Configuration.IConfigMapPath2.MapPath(String siteID, VirtualPath path) at System.Web.Configuration.WebConfigurationHost.InitForConfiguration(String& locationSubPath, String& configPath, String& locationConfigPath, IInternalConfigRoot configRoot, Object[] hostInitConfigurationParams) at System.Configuration.Configuration..ctor(String locationSubPath, Type typeConfigHost, Object[] hostInitConfigurationParams) at System.Configuration.Internal.InternalConfigConfigurationFactory.System.Configuration.Internal.IInternalConfigConfigurationFactory.Create(Type typeConfigHost, Object[] hostInitConfigurationParams) at System.Web.Configuration.WebConfigurationHost.OpenConfiguration(WebLevel webLevel, ConfigurationFileMap fileMap, VirtualPath path, String site, String locationSubPath, String server, String userName, String password, IntPtr tokenHandle) at System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(String path) at appName.FormName.Form_Load(Object sender, EventArgs e) in E:\myapp\page.vb:line 130
i have to install it by two day so please help me
thanks in advanced
Comment