re:
!> I haven't been asked about any conversions. I simply opened VWD2008 Express
!> and opened the SLN-file containing the solution i've been working in VS2005.
!> It just got opened and the only nag i got was one for converting the line breaks to Windows format.
That's really odd.
Everytime I create a project in VS 2005 and later open
the .sln file with VWD, the conversion wizard runs.
re:
!> As far i could see, there was no "section" tags in my web.config file.
There wouldn't be. Those sections go into the machine.config file.
What I asked you was to check whether you web.config contained references to those objects.
re:
!> The line i'm directed to when clicking on the error description says:
!> <authentication mode="Forms">
Yes, that's the reference to <section name="authentication".
What authentication code do you have in your app ?
Do you have a logon page which requests credentials from your users ?
Here's a complete example to test the authentication capability you seem to be missing:
Could you create a new project in VWD, copy the 3 files
I included in web.zip into the new project and run *default.aspx*
by right-clicking it in the Solution Explorer and selecting "View in Browser" ?
....and then post back the results of your test ?
You should get prompted for authentication.
Use "(e-mail address removed)" for both the username and the password.
You should first be sent to login.aspx and then, after inputting the credentials above,
be redirected to login.aspx where the username "(e-mail address removed)" will be displayed.
In case you can't download zip files, here's the text of the files :
web.config:
-----------------
<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings/>
<system.web>
<compilation debug="true" strict="false" explicit="true">
</compilation>
<pages>
<namespaces>
<clear/>
<add namespace="System"/>
<add namespace="System.Collections"/>
<add namespace="System.Collections.Specialized"/>
<add namespace="System.Configuration"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
<add namespace="System.Web.Caching"/>
<add namespace="System.Web.SessionState"/>
<add namespace="System.Web.Security"/>
<add namespace="System.Web.Profile"/>
<add namespace="System.Web.UI"/>
<add namespace="System.Web.UI.WebControls"/>
<add namespace="System.Web.UI.WebControls.WebParts"/>
<add namespace="System.Web.UI.HtmlControls"/>
</namespaces>
</pages>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Forms">
<forms loginUrl="login.aspx" name=".ASPXFORMSAUTH">
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
<system.codedom>
</system.codedom>
<system.webServer>
</system.webServer>
</configuration>
-----------------------
default.aspx:
------------------
<%@ Page Language="VB" %>
<html>
<head>
<title>Forms Authentication - Default Page</title>
</head>
<script runat="server">
Sub Page_Load(ByVal Src As Object, ByVal e As EventArgs)
Welcome.Text = "Hello, " & Context.User.Identity.Name
End Sub
Sub Signout_Click(ByVal sender As Object, ByVal e As EventArgs)
FormsAuthentication.SignOut()
Response.Redirect("Login.aspx")
End Sub
</script>
<body>
<h3>
Using Forms Authentication</h3>
<asp:Label ID="Welcome" runat="server" />
<form id="Form1" runat="server">
<asp:Button ID="Submit1" OnClick="Signout_Click"
Text="Sign Out" runat="server" /><p>
</form>
</body>
</html>
------------
login.aspx:
-----------------
<%@ Page Language="VB" %>
<%@ Import Namespace="System.Web.Security" %>
<script runat="server">
Sub Logon_Click(ByVal sender As Object, ByVal e As EventArgs)
If ((UserEmail.Text = "(e-mail address removed)") And _
(UserPass.Text = "(e-mail address removed)")) Then
FormsAuthentication.RedirectFromLoginPage _
(UserEmail.Text, Persist.Checked)
Else
Msg.Text = "Invalid credentials. Please try again."
End If
End Sub
</script>
<html>
<head id="Head1" runat="server">
<title>Forms Authentication - Login</title>
</head>
<body>
<form id="form1" runat="server">
<h3>
Logon Page</h3>
<table>
<tr>
<td>
E-mail address:</td>
<td>
<asp:TextBox ID="UserEmail" runat="server" /></td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="UserEmail"
Display="Dynamic"
ErrorMessage="Cannot be empty."
runat="server" />
</td>
</tr>
<tr>
<td>
Password:</td>
<td>
<asp:TextBox ID="UserPass" TextMode="Password"
runat="server" />
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
ControlToValidate="UserPass"
ErrorMessage="Cannot be empty."
runat="server" />
</td>
</tr>
<tr>
<td>
Remember me?</td>
<td>
<asp:CheckBox ID="Persist" runat="server" /></td>
</tr>
</table>
<asp:Button ID="Submit1" OnClick="Logon_Click" Text="Log On" runat="server" />
<p>
<asp:Label ID="Msg" ForeColor="red" runat="server" />
</p>
</form>
</body>
</html>
-----------
Running those 2 pages with the web.config will tell you if
the problem is with VWD...or with your authentication code.
Please post back the results of the test, OK ?
K Viltersten said:
!> when i try to run index.aspx, i get error message as follows:
!> Error 95 It is an error to use a section registered as
!> allowDefinition='MachineToApplication' beyond application level.
Did you convert the project when you first opened it inVWD 2008?
I haven't been asked about any conversions. I simply opened
VWD2008 Express and opened the SLN-file containig the
solution i've been working in VS2005. It just got opened
and the only nag i got was one for converting the line breaks
to Windows format.
re:
!> It's also suggested that it might be due to that the directory isn't
!> configured as an application in the IIS. What can be done to resolve
it?
I suggest you check the specific setting which is causing theproblem in
your web.config.
There's not too many of them:
<section name="anonymousIdentification"
<section name="authentication"
<section name="healthMonitoring"
<section name="hostingEnvironment"
<section name="machineKey"
<section name="membership"
<section name="profile"
<section name="roleManager"
<section name="securityPolicy"
<section name="sessionState"
<section name="siteMap"
<section name="trust"
<section name="urlMappings"
<section name="cache"
<section name="outputCache"
<section name="outputCacheSettings"
<section name="sqlCacheDependency"
As far i could see, there was no "section" tags in my web.config
file. The line i'm directed to when clicking on the error
description says:
<system.web>
<customErrors defaultRedirect="Error.aspx" mode="RemoteOnly"/>
BELOW IS THE LINE
<authentication mode="Forms">
ABOVE IS THE LINE
<forms timeout="10000"/>
</authentication>
<compilation debug="true">
<assemblies>
<add assembly="System.DirectoryServices, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=B03F5F7F11D50A3A"/>
</assemblies>
</compilation>
</system.web>