web.config file problem

  • Thread starter Thread starter c676228
  • Start date Start date
C

c676228

Hi all,

I cut and paste the following code from msdn help page which it just
introduces view and multiview server controls.

Here is what I do:
in vs studio 2005, File --> New Web Site, it brings me to the dir: C:\Visual
Studio 2005\WebSites\WebSite1, it creates default.aspx and default.aspx.vb
and I pasted the following code into default.aspx.
I go to build to build web site and it says:------ Build started: Project:
C:\...\WebSite1\, Configuration: Debug .NET ------
Validating Web Site
Building directory '/WebSite1/'.
So I created virtual dir website1 to point to C:\Visual Studio
2005\WebSites\WebSite1
Then I ran localhost/webSite1/default.aspx
The following error message comes up:
Parser Error Message: Unrecognized configuration section 'connectionStrings'

Source Error:
Line 10: <configuration>
Line 11: <appSettings/>
Line 12: <connectionStrings/>
Line 13: <system.web>
Line 14: <!--

Source File: C:\Visual Studio 2005\WebSites\WebSite1\web.config Line: 12

I don't know why since it is created by vs by default. so I commented out.

The open the page again, then the following message comes up:
Description: An error occurred during the processing of a configuration file
required to service this request. Please review the specific error details
below and modify your configuration file appropriately.

Parser Error Message: Child nodes are not allowed.

Source Error:


Line 25: <compilation debug="false" strict="false" explicit="true" />
Line 26: <pages>
Line 27: <namespaces>
Line 28: <clear />
Line 29: <add namespace="System" />


Source File: C:\Visual Studio 2005\WebSites\WebSite1\web.config Line: 27
and I delete that part.
And I opened the page again:
Now the error message is:
Description: An error occurred during the parsing of a resource required to
service this request. Please review the following specific parse error
details and modify your source file appropriately.

Parser Error Message: Could not load type
System.Web.UI.WebControls.MultiView from assembly System.Web,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

Source Error:


Line 44: <h3>MultiView Class Example</h3>
Line 45:
Line 46: <asp:MultiView id="MultiView1"
Line 47: runat="Server">
Line 48:


Source File: C:\Visual Studio 2005\WebSites\WebSite1\default.aspx Line: 46
I never encounter this kind of problem before, can you help?

Thanks.

Betty


<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html >
<head>
<title>MultiView Class Example</title>
<script runat="server">

Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
' The first time the page loads,
' render the DefaultView.
If Not IsPostBack Then
' Set DefaultView as the active view.
MultiView1.SetActiveView(DefaultView)
End If

End Sub

Sub LinkButton_Command(sender As Object, e As
System.Web.UI.WebControls.CommandEventArgs)
' Determine which link button was clicked
' and set the active view to
' the view selected by the user.
Select Case (e.CommandArgument)
Case "DefaultView"
MultiView1.SetActiveView(DefaultView)
Case "News"
MultiView1.SetActiveView(NewsView)
Case "Shopping"
MultiView1.SetActiveView(ShoppingView)
Case Else
Throw New Exception("You did not select a valid list
item.")

End Select

End Sub

</script>

</head>
<body>
<form id="Form1" runat="server">

<h3>MultiView Class Example</h3>

<asp:MultiView id="MultiView1"
runat="Server">

<asp:View id="DefaultView"
runat="Server">

<asp:Panel id="DefaultViewPanel"
Width="330px"
BackColor="#C0C0FF"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">

<asp:Label id="DefaultLabel1"
Font-bold="true"
Font-size="14"
Text="The Default View"
runat="Server"
AssociatedControlID="DefaultView">
</asp:Label>

<asp:BulletedList id="DefaultBulletedList1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Today's Weather</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Stock Quotes</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's News Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Featured Shopping</asp:ListItem>
</asp:BulletedList>

<hr />

<asp:Label id="DefaultLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />

<asp:LinkButton id="Default_NewsLink"
Text="Go to News View"
OnCommand="LinkButton_Command"
CommandArgument="News"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>

<asp:LinkButton id="Default_ShoppingLink"
Text="Go to Shopping View"
OnCommand="LinkButton_Command"
CommandArgument="Shopping"
CommandName="Link"
Width="150px"
runat="server">
</asp:LinkButton><br /><br />

</asp:Panel>

</asp:View>

<asp:View id="NewsView"
runat="Server">

<asp:Panel id="NewsPanel1"
Width="330px"
BackColor="#C0FFC0"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">

<asp:Label id="NewsLabel1"
Font-bold="true"
Font-size="14"
Text="The News View"
runat="Server"
AssociatedControlID="NewsView">
</asp:Label>

<asp:BulletedList id="NewsBulletedlist1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Today's International
Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's National Headlines</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Today's Local News</asp:ListItem>
</asp:BulletedList>

<hr />

<asp:Label id="NewsLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />

<asp:LinkButton id="News_DefaultLink"
Text="Go to the Default View"
OnCommand="LinkButton_Command"
CommandArgument="DefaultView"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>

<asp:LinkButton id="News_ShoppingLink"
Text="Go to Shopping View"
OnCommand="LinkButton_Command"
CommandArgument="Shopping"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton><br /><br />

</asp:Panel>

</asp:View>

<asp:View id="ShoppingView"
runat="Server">

<asp:Panel id="ShoppingPanel1"
Width="330px"
BackColor="#FFFFC0"
BorderColor="#404040"
BorderStyle="Double"
runat="Server">

<asp:Label id="ShoppingLabel1"
Font-Bold="true"
Font-size="14"
Text="The Shopping View"
runat="Server"
AssociatedControlID="ShoppingView">
</asp:Label>

<asp:BulletedList id="ShoppingBulletedlist1"
BulletStyle="Disc"
DisplayMode="Hyperlink"
Target="_blank"
runat="Server">
<asp:ListItem
Value="http://www.microsoft.com">Shop for Home and Garden </asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Shop for Women's Fashions</asp:ListItem>
<asp:ListItem
Value="http://www.microsoft.com">Shop for Men's Fashions</asp:ListItem>
</asp:BulletedList>

<hr />

<asp:Label id="ShoppingLabel2"
Font-size="12"
Text="Click a link to display a different view:"
runat="Server">
</asp:Label><br />

<asp:LinkButton id="Shopping_DefaultLink"
Text="Go to the Default View"
OnCommand="LinkButton_Command"
CommandArgument="DefaultView"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton>

<asp:LinkButton id="Shopping_NewsLink"
Text="Go to News View"
OnCommand="LinkButton_Command"
CommandArgument="News"
CommandName="Link"
Width="150px"
runat="Server">
</asp:LinkButton><br /><br />

</asp:Panel>

</asp:View>

</asp:MultiView>

</form>
</body>
</html>
 
Hi Betty,

Nice to see you.

Seems you start moving to ASP.NET recently?

Regarding on the the problem you encountered, here are my understanding and
some suggestions:

1. Start from Visual Studio 2005(and VS 2008), Visual studio provide a test
webserver for developing and debugging ASP.NET web application. Therefore,
at development time, you can directly select a page and to "view in
browser" or event start F5 to debug without deploying it to IIS:

http://dotnetfortherestofus.blogspot.com/2006/07/vs-2005s-personal-developme
nt.html

and that's also why visual studio let you choose a normal file system
directory(rather than IIS virtual directory though you can still choose to
create the project in IIS) when you create a new web site project.


2. As for the following error you mentioned (after deploy the the web site
directory into IIS):

"Parser Error Message: Unrecognized configuration section
'connectionStrings' "

based on my experience, this is a typical error which occurs when you
deploy an ASP.NET 2.0 application in a IIS virtual dir which is configured
to run .NET 1.1/ASP.NET 1.1

Therefore, I suggest you check whether the IIS(site or the application
virtual directory) has been configured as .NET 2.0. There should has a
"ASPNET" tab in the IIS virtual dir MMC to let you configure version. Here
is a web thread which also discussing on this:

http://forums.msdn.microsoft.com/en-US/csharpgeneral/thread/f3df53fe-666b-4a
98-92d2-d6e4ba52552a

For other sequential issue, I think some of them may also be related to the
runtime configuration. I suggest you first try the above things and make an
simple ASP.NET application(and some basic page that use some simple
controls) running. Then, we can continue to focus on other specific issues.

If you have anything unclear, please feel free to let me know.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
-------------------------
 
Steven,

Excellent info. I tried 1. and I do see the page through view in browser.
Nice feature.
Yes , you are right, after I set up asp.net 2.0. Everything is OK.

I am moving to asp.net 2.0 and C#. I probably will post a lot of questions
later on.
Fabulous support.
 
No problem!

Welcome to post here and thanks for the contribution to the newsgroup:)

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
From: =?Utf-8?B?YzY3NjIyOA==?= <[email protected]>
References: <[email protected]>
Subject: RE: web.config file problem
Date: Wed, 30 Jul 2008 19:08:01 -0700
 
Back
Top