Hi All,
I've got the following .aspx file with the then following .cs code. The
page renders fine on first run, but once I click the submit, it just comes
back with a cannot be displayed page indicating that the page is not
available. Anyone see what probably obvious or stupid thing I'm missing?
TIA,
John
Test.aspx:
========
<%@dotnet.itags.org. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
<html>
<head>
</head>
<body>
<form runat="server">
<asp:datagrid id="grdAccount" runat="server" Height="100%"
Width="100%"></asp:datagrid>
<input type="submit" value="Submit Query" runat="server" />
</form>
</body>
</html
Temp.cs code:
==========
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.OleDb;
public class dgrdAccountSort : Page
{
private string SortExpression;
protected DataGrid grdAccount;
protected void Page_Load(object Src, EventArgs e)
{
BindGridReader();
}
public void BindGridReader()
{
string SelectCommand = "SELECT * FROM AcctName";
if (SortExpression != null)
SelectCommand += " ORDER BY " + SortExpression;
OleDbConnection conn = new OleDbConnection(@dotnet.itags.org."Provider=vfpoledb.1;User
Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
);
OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
conn.Open();
IDataReader reader = cmd.ExecuteReader();
grdAccount.DataSource = reader;
grdAccount.DataBind();
conn.Dispose();
}
}John,
Instead of Connection.Dispose();
Use Connection.Close(); and then Connection.Dispose() instead.
Connection.Dispose() tells the .Net garbage collector that it's okay to
dispose of an object when it gets around to it. It does not close the
connection.
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> Hi All,
> I've got the following .aspx file with the then following .cs code. The
> page renders fine on first run, but once I click the submit, it just comes
> back with a cannot be displayed page indicating that the page is not
> available. Anyone see what probably obvious or stupid thing I'm missing?
> TIA,
> John
> Test.aspx:
> ========
> <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> <html>
> <head>
> </head>
> <body>
> <form runat="server">
> <asp:datagrid id="grdAccount" runat="server" Height="100%"
> Width="100%"></asp:datagrid>
> <input type="submit" value="Submit Query" runat="server" />
> </form>
> </body>
> </html>
>
> Temp.cs code:
> ==========
> using System;
> using System.Web;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Data;
> using System.Data.OleDb;
> public class dgrdAccountSort : Page
> {
> private string SortExpression;
> protected DataGrid grdAccount;
> protected void Page_Load(object Src, EventArgs e)
> {
> BindGridReader();
> }
>
> public void BindGridReader()
> {
> string SelectCommand = "SELECT * FROM AcctName";
> if (SortExpression != null)
> SelectCommand += " ORDER BY " + SortExpression;
> OleDbConnection conn = new OleDbConnection(@."Provider=vfpoledb.1;User
> Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> );
> OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> conn.Open();
> IDataReader reader = cmd.ExecuteReader();
> grdAccount.DataSource = reader;
> grdAccount.DataBind();
> conn.Dispose();
> }
> }
Just a thought - have you tried closing the connection by setting the
commandbehavior of your command to do so after the Datareader is closed. And
then close the datareader after binding?
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> Hi All,
> I've got the following .aspx file with the then following .cs code. The
> page renders fine on first run, but once I click the submit, it just comes
> back with a cannot be displayed page indicating that the page is not
> available. Anyone see what probably obvious or stupid thing I'm missing?
> TIA,
> John
> Test.aspx:
> ========
> <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> <html>
> <head>
> </head>
> <body>
> <form runat="server">
> <asp:datagrid id="grdAccount" runat="server" Height="100%"
> Width="100%"></asp:datagrid>
> <input type="submit" value="Submit Query" runat="server" />
> </form>
> </body>
> </html>
>
> Temp.cs code:
> ==========
> using System;
> using System.Web;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Data;
> using System.Data.OleDb;
> public class dgrdAccountSort : Page
> {
> private string SortExpression;
> protected DataGrid grdAccount;
> protected void Page_Load(object Src, EventArgs e)
> {
> BindGridReader();
> }
>
> public void BindGridReader()
> {
> string SelectCommand = "SELECT * FROM AcctName";
> if (SortExpression != null)
> SelectCommand += " ORDER BY " + SortExpression;
> OleDbConnection conn = new OleDbConnection(@."Provider=vfpoledb.1;User
> Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> );
> OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> conn.Open();
> IDataReader reader = cmd.ExecuteReader();
> grdAccount.DataSource = reader;
> grdAccount.DataBind();
> conn.Dispose();
> }
> }
Just a thought - have you tried closing the connection by setting the
commandbehavior of your command to do so after the Datareader is closed. And
then close the datareader after binding?
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> Hi All,
> I've got the following .aspx file with the then following .cs code. The
> page renders fine on first run, but once I click the submit, it just comes
> back with a cannot be displayed page indicating that the page is not
> available. Anyone see what probably obvious or stupid thing I'm missing?
> TIA,
> John
> Test.aspx:
> ========
> <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> <html>
> <head>
> </head>
> <body>
> <form runat="server">
> <asp:datagrid id="grdAccount" runat="server" Height="100%"
> Width="100%"></asp:datagrid>
> <input type="submit" value="Submit Query" runat="server" />
> </form>
> </body>
> </html>
>
> Temp.cs code:
> ==========
> using System;
> using System.Web;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Data;
> using System.Data.OleDb;
> public class dgrdAccountSort : Page
> {
> private string SortExpression;
> protected DataGrid grdAccount;
> protected void Page_Load(object Src, EventArgs e)
> {
> BindGridReader();
> }
>
> public void BindGridReader()
> {
> string SelectCommand = "SELECT * FROM AcctName";
> if (SortExpression != null)
> SelectCommand += " ORDER BY " + SortExpression;
> OleDbConnection conn = new OleDbConnection(@."Provider=vfpoledb.1;User
> Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> );
> OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> conn.Open();
> IDataReader reader = cmd.ExecuteReader();
> grdAccount.DataSource = reader;
> grdAccount.DataBind();
> conn.Dispose();
> }
> }
John,
Sorry, but that was the only thing I could see that might have been wrong
with your code...
That said, I mostly program in VB.Net so maybe someone with more C#
experience could spot something else to try.
Good luck with it!
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:e1doDH0aDHA.1280@.tk2msftngp13.phx.gbl...
> Thanks for getting involved! Unfortunately, I inserted a conn.Close()
> before the conn.Dispose() and it appears to do the same thing (work first
> time then die the second).
> FWIW, I'm using WebMatrix, the 1.1 version of .NET framework on a Win2K
pro
> machine.
> - John
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:#wLKf6zaDHA.388@.TK2MSFTNGP10.phx.gbl...
> > John,
> > Instead of Connection.Dispose();
> > Use Connection.Close(); and then Connection.Dispose() instead.
> > Connection.Dispose() tells the .Net garbage collector that it's okay to
> > dispose of an object when it gets around to it. It does not close the
> > connection.
> > Sincerely,
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> > Free code library at:
> > www.aboutfortunate.com
> > "Out of chaos comes order."
> > Nietzche
> > "John Spiegel" <jspiegel@.c-comld.com> wrote in message
> > news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> > > Hi All,
> > > > I've got the following .aspx file with the then following .cs code.
The
> > > page renders fine on first run, but once I click the submit, it just
> comes
> > > back with a cannot be displayed page indicating that the page is not
> > > available. Anyone see what probably obvious or stupid thing I'm
> missing?
> > > > TIA,
> > > > John
> > > > Test.aspx:
> > > ========
> > > > <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> > > <html>
> > > <head>
> > > </head>
> > > <body>
> > > <form runat="server">
> > > <asp:datagrid id="grdAccount" runat="server" Height="100%"
> > > Width="100%"></asp:datagrid>
> > > <input type="submit" value="Submit Query" runat="server" />
> > > </form>
> > > </body>
> > > </html>
> > > > > Temp.cs code:
> > > ==========
> > > using System;
> > > using System.Web;
> > > using System.Web.UI;
> > > using System.Web.UI.WebControls;
> > > using System.Data;
> > > using System.Data.OleDb;
> > > > public class dgrdAccountSort : Page
> > > {
> > > private string SortExpression;
> > > protected DataGrid grdAccount;
> > > > protected void Page_Load(object Src, EventArgs e)
> > > {
> > > BindGridReader();
> > > }
> > > > > public void BindGridReader()
> > > {
> > > string SelectCommand = "SELECT * FROM AcctName";
> > > if (SortExpression != null)
> > > SelectCommand += " ORDER BY " + SortExpression;
> > > > OleDbConnection conn = new
OleDbConnection(@."Provider=vfpoledb.1;User
> > > Id=;Password=;Data
> Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> > > );
> > > OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> > > > conn.Open();
> > > IDataReader reader = cmd.ExecuteReader();
> > > grdAccount.DataSource = reader;
> > > grdAccount.DataBind();
> > > > conn.Dispose();
> > > }
> > > }
> >
John,
Sorry, but that was the only thing I could see that might have been wrong
with your code...
That said, I mostly program in VB.Net so maybe someone with more C#
experience could spot something else to try.
Good luck with it!
Sincerely,
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:e1doDH0aDHA.1280@.tk2msftngp13.phx.gbl...
> Thanks for getting involved! Unfortunately, I inserted a conn.Close()
> before the conn.Dispose() and it appears to do the same thing (work first
> time then die the second).
> FWIW, I'm using WebMatrix, the 1.1 version of .NET framework on a Win2K
pro
> machine.
> - John
> "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> news:#wLKf6zaDHA.388@.TK2MSFTNGP10.phx.gbl...
> > John,
> > Instead of Connection.Dispose();
> > Use Connection.Close(); and then Connection.Dispose() instead.
> > Connection.Dispose() tells the .Net garbage collector that it's okay to
> > dispose of an object when it gets around to it. It does not close the
> > connection.
> > Sincerely,
> > --
> > S. Justin Gengo, MCP
> > Web Developer
> > Free code library at:
> > www.aboutfortunate.com
> > "Out of chaos comes order."
> > Nietzche
> > "John Spiegel" <jspiegel@.c-comld.com> wrote in message
> > news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> > > Hi All,
> > > > I've got the following .aspx file with the then following .cs code.
The
> > > page renders fine on first run, but once I click the submit, it just
> comes
> > > back with a cannot be displayed page indicating that the page is not
> > > available. Anyone see what probably obvious or stupid thing I'm
> missing?
> > > > TIA,
> > > > John
> > > > Test.aspx:
> > > ========
> > > > <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> > > <html>
> > > <head>
> > > </head>
> > > <body>
> > > <form runat="server">
> > > <asp:datagrid id="grdAccount" runat="server" Height="100%"
> > > Width="100%"></asp:datagrid>
> > > <input type="submit" value="Submit Query" runat="server" />
> > > </form>
> > > </body>
> > > </html>
> > > > > Temp.cs code:
> > > ==========
> > > using System;
> > > using System.Web;
> > > using System.Web.UI;
> > > using System.Web.UI.WebControls;
> > > using System.Data;
> > > using System.Data.OleDb;
> > > > public class dgrdAccountSort : Page
> > > {
> > > private string SortExpression;
> > > protected DataGrid grdAccount;
> > > > protected void Page_Load(object Src, EventArgs e)
> > > {
> > > BindGridReader();
> > > }
> > > > > public void BindGridReader()
> > > {
> > > string SelectCommand = "SELECT * FROM AcctName";
> > > if (SortExpression != null)
> > > SelectCommand += " ORDER BY " + SortExpression;
> > > > OleDbConnection conn = new
OleDbConnection(@."Provider=vfpoledb.1;User
> > > Id=;Password=;Data
> Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> > > );
> > > OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> > > > conn.Open();
> > > IDataReader reader = cmd.ExecuteReader();
> > > grdAccount.DataSource = reader;
> > > grdAccount.DataBind();
> > > > conn.Dispose();
> > > }
> > > }
> >
Not yet, I'll give it a shot! I did find some very similar code code that
is working so I can use it to find my mistake. Thanks for the advice, Rick!
- John
"Rick Spiewak" <rickspiewak@.mindspring.com> wrote in message
news:#uNhx04aDHA.2436@.TK2MSFTNGP12.phx.gbl...
> Just a thought - have you tried closing the connection by setting the
> commandbehavior of your command to do so after the Datareader is closed.
And
> then close the datareader after binding?
> "John Spiegel" <jspiegel@.c-comld.com> wrote in message
> news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> > Hi All,
> > I've got the following .aspx file with the then following .cs code. The
> > page renders fine on first run, but once I click the submit, it just
comes
> > back with a cannot be displayed page indicating that the page is not
> > available. Anyone see what probably obvious or stupid thing I'm
missing?
> > TIA,
> > John
> > Test.aspx:
> > ========
> > <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> > <html>
> > <head>
> > </head>
> > <body>
> > <form runat="server">
> > <asp:datagrid id="grdAccount" runat="server" Height="100%"
> > Width="100%"></asp:datagrid>
> > <input type="submit" value="Submit Query" runat="server" />
> > </form>
> > </body>
> > </html>
> > Temp.cs code:
> > ==========
> > using System;
> > using System.Web;
> > using System.Web.UI;
> > using System.Web.UI.WebControls;
> > using System.Data;
> > using System.Data.OleDb;
> > public class dgrdAccountSort : Page
> > {
> > private string SortExpression;
> > protected DataGrid grdAccount;
> > protected void Page_Load(object Src, EventArgs e)
> > {
> > BindGridReader();
> > }
> > public void BindGridReader()
> > {
> > string SelectCommand = "SELECT * FROM AcctName";
> > if (SortExpression != null)
> > SelectCommand += " ORDER BY " + SortExpression;
> > OleDbConnection conn = new OleDbConnection(@."Provider=vfpoledb.1;User
> > Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> > );
> > OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> > conn.Open();
> > IDataReader reader = cmd.ExecuteReader();
> > grdAccount.DataSource = reader;
> > grdAccount.DataBind();
> > conn.Dispose();
> > }
> > }
Not yet, I'll give it a shot! I did find some very similar code code that
is working so I can use it to find my mistake. Thanks for the advice, Rick!
- John
"Rick Spiewak" <rickspiewak@.mindspring.com> wrote in message
news:#uNhx04aDHA.2436@.TK2MSFTNGP12.phx.gbl...
> Just a thought - have you tried closing the connection by setting the
> commandbehavior of your command to do so after the Datareader is closed.
And
> then close the datareader after binding?
> "John Spiegel" <jspiegel@.c-comld.com> wrote in message
> news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> > Hi All,
> > I've got the following .aspx file with the then following .cs code. The
> > page renders fine on first run, but once I click the submit, it just
comes
> > back with a cannot be displayed page indicating that the page is not
> > available. Anyone see what probably obvious or stupid thing I'm
missing?
> > TIA,
> > John
> > Test.aspx:
> > ========
> > <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> > <html>
> > <head>
> > </head>
> > <body>
> > <form runat="server">
> > <asp:datagrid id="grdAccount" runat="server" Height="100%"
> > Width="100%"></asp:datagrid>
> > <input type="submit" value="Submit Query" runat="server" />
> > </form>
> > </body>
> > </html>
> > Temp.cs code:
> > ==========
> > using System;
> > using System.Web;
> > using System.Web.UI;
> > using System.Web.UI.WebControls;
> > using System.Data;
> > using System.Data.OleDb;
> > public class dgrdAccountSort : Page
> > {
> > private string SortExpression;
> > protected DataGrid grdAccount;
> > protected void Page_Load(object Src, EventArgs e)
> > {
> > BindGridReader();
> > }
> > public void BindGridReader()
> > {
> > string SelectCommand = "SELECT * FROM AcctName";
> > if (SortExpression != null)
> > SelectCommand += " ORDER BY " + SortExpression;
> > OleDbConnection conn = new OleDbConnection(@."Provider=vfpoledb.1;User
> > Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> > );
> > OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> > conn.Open();
> > IDataReader reader = cmd.ExecuteReader();
> > grdAccount.DataSource = reader;
> > grdAccount.DataBind();
> > conn.Dispose();
> > }
> > }
I appreciate the time looking into it! It's been a long time since I've
picked up a new language so now I'm trying to basically do two at once!
Yea! <g
"S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
news:#Xz3CQ6aDHA.2672@.tk2msftngp13.phx.gbl...
> John,
> Sorry, but that was the only thing I could see that might have been wrong
> with your code...
> That said, I mostly program in VB.Net so maybe someone with more C#
> experience could spot something else to try.
> Good luck with it!
> Sincerely,
> --
> S. Justin Gengo, MCP
> Web Developer
> Free code library at:
> www.aboutfortunate.com
> "Out of chaos comes order."
> Nietzche
>
> "John Spiegel" <jspiegel@.c-comld.com> wrote in message
> news:e1doDH0aDHA.1280@.tk2msftngp13.phx.gbl...
> > Thanks for getting involved! Unfortunately, I inserted a conn.Close()
> > before the conn.Dispose() and it appears to do the same thing (work
first
> > time then die the second).
> > FWIW, I'm using WebMatrix, the 1.1 version of .NET framework on a Win2K
> pro
> > machine.
> > - John
> > "S. Justin Gengo" <sjgengo@.aboutfortunate.com> wrote in message
> > news:#wLKf6zaDHA.388@.TK2MSFTNGP10.phx.gbl...
> > > John,
> > > > Instead of Connection.Dispose();
> > > > Use Connection.Close(); and then Connection.Dispose() instead.
> > > > Connection.Dispose() tells the .Net garbage collector that it's okay
to
> > > dispose of an object when it gets around to it. It does not close the
> > > connection.
> > > > Sincerely,
> > > > --
> > > S. Justin Gengo, MCP
> > > Web Developer
> > > > Free code library at:
> > > www.aboutfortunate.com
> > > > "Out of chaos comes order."
> > > Nietzche
> > > > > "John Spiegel" <jspiegel@.c-comld.com> wrote in message
> > > news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> > > > Hi All,
> > > > > > I've got the following .aspx file with the then following .cs code.
> The
> > > > page renders fine on first run, but once I click the submit, it just
> > comes
> > > > back with a cannot be displayed page indicating that the page is not
> > > > available. Anyone see what probably obvious or stupid thing I'm
> > missing?
> > > > > > TIA,
> > > > > > John
> > > > > > Test.aspx:
> > > > ========
> > > > > > <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> > > > <html>
> > > > <head>
> > > > </head>
> > > > <body>
> > > > <form runat="server">
> > > > <asp:datagrid id="grdAccount" runat="server" Height="100%"
> > > > Width="100%"></asp:datagrid>
> > > > <input type="submit" value="Submit Query" runat="server" />
> > > > </form>
> > > > </body>
> > > > </html>
> > > > > > > > Temp.cs code:
> > > > ==========
> > > > using System;
> > > > using System.Web;
> > > > using System.Web.UI;
> > > > using System.Web.UI.WebControls;
> > > > using System.Data;
> > > > using System.Data.OleDb;
> > > > > > public class dgrdAccountSort : Page
> > > > {
> > > > private string SortExpression;
> > > > protected DataGrid grdAccount;
> > > > > > protected void Page_Load(object Src, EventArgs e)
> > > > {
> > > > BindGridReader();
> > > > }
> > > > > > > > public void BindGridReader()
> > > > {
> > > > string SelectCommand = "SELECT * FROM AcctName";
> > > > if (SortExpression != null)
> > > > SelectCommand += " ORDER BY " + SortExpression;
> > > > > > OleDbConnection conn = new
> OleDbConnection(@."Provider=vfpoledb.1;User
> > > > Id=;Password=;Data
> > > Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> > > > );
> > > > OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> > > > > > conn.Open();
> > > > IDataReader reader = cmd.ExecuteReader();
> > > > grdAccount.DataSource = reader;
> > > > grdAccount.DataBind();
> > > > > > conn.Dispose();
> > > > }
> > > > }
> > > > > >
FYI, As it turns out, the error seems to be tied to my not limiting the
amount of the table it displayed on the page. Once I narrowed it down to 20
rows at a time, the error went away. I'm not clear as to whether that's a
configurable limitation or not.
- John
"John Spiegel" <jspiegel@.c-comld.com> wrote in message
news:uoAcTxzaDHA.652@.tk2msftngp13.phx.gbl...
> Hi All,
> I've got the following .aspx file with the then following .cs code. The
> page renders fine on first run, but once I click the submit, it just comes
> back with a cannot be displayed page indicating that the page is not
> available. Anyone see what probably obvious or stupid thing I'm missing?
> TIA,
> John
> Test.aspx:
> ========
> <%@. Page Language="C#" src="http://pics.10026.com/?src=Temp.cs" Inherits="dgrdAccountSort" %>
> <html>
> <head>
> </head>
> <body>
> <form runat="server">
> <asp:datagrid id="grdAccount" runat="server" Height="100%"
> Width="100%"></asp:datagrid>
> <input type="submit" value="Submit Query" runat="server" />
> </form>
> </body>
> </html>
>
> Temp.cs code:
> ==========
> using System;
> using System.Web;
> using System.Web.UI;
> using System.Web.UI.WebControls;
> using System.Data;
> using System.Data.OleDb;
> public class dgrdAccountSort : Page
> {
> private string SortExpression;
> protected DataGrid grdAccount;
> protected void Page_Load(object Src, EventArgs e)
> {
> BindGridReader();
> }
>
> public void BindGridReader()
> {
> string SelectCommand = "SELECT * FROM AcctName";
> if (SortExpression != null)
> SelectCommand += " ORDER BY " + SortExpression;
> OleDbConnection conn = new OleDbConnection(@."Provider=vfpoledb.1;User
> Id=;Password=;Data
Source=C:\temp\dotnet1.1\asp\essentials\samples\my testing\IntelligentOffice"
> );
> OleDbCommand cmd = new OleDbCommand( SelectCommand, conn );
> conn.Open();
> IDataReader reader = cmd.ExecuteReader();
> grdAccount.DataSource = reader;
> grdAccount.DataBind();
> conn.Dispose();
> }
> }
Showing posts with label following. Show all posts
Showing posts with label following. Show all posts
Monday, March 26, 2012
Friday, March 16, 2012
Newline detected when add script in C# (ASP.NET)
Hi!
I'm trying to add script to the page and place following code in my ascx
(control):
Page.RegisterClientScriptBlock("adder", "<script>function
doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
eval(document.all.TextBox2.value)}</script>");
It doesn't work giving me all kind of problems...
I suspect the problem is with <> charachters.
How do I go around this problem?
Also, placing this line in code (I use WebMatrix) will mess up all HTML
code??
Thanks!If that is the exact line from your code, then it just has to do with how
your formed your string. You cannot insert a line break in a string in C#.
It should work if you change your code to read:
Page.RegisterClientScriptBlock("adder", "<script>function " +
"doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
" +
"eval(document.all.TextBox2.value)}</script>");
or, for more readability, I always for my javascript in a temp variable
first. Just kinda hard to read otherwise
string script = "<script>function " +
"doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
" +
"eval(document.all.TextBox2.value)}</script>"
Page.RegisterClientScriptBlock("adder", script);
either way, both of those should work for you.
-Cliff
"Ivan Demkovitch" <i@.a.b> wrote in message
news:OfydJF8oDHA.976@.tk2msftngp13.phx.gbl...
> Hi!
> I'm trying to add script to the page and place following code in my ascx
> (control):
>
> Page.RegisterClientScriptBlock("adder", "<script>function
> doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
> eval(document.all.TextBox2.value)}</script>");
> It doesn't work giving me all kind of problems...
> I suspect the problem is with <> charachters.
> How do I go around this problem?
> Also, placing this line in code (I use WebMatrix) will mess up all HTML
> code??
> Thanks!
I solved problem...
Actually the problem was in "</script>"
Changed to "<" + "/" + "script>" and it works fine now.
Thanks!
"Cliff Harris" <hersh@.myrealbox.com> wrote in message
news:OkD03L8oDHA.644@.TK2MSFTNGP11.phx.gbl...
> If that is the exact line from your code, then it just has to do with how
> your formed your string. You cannot insert a line break in a string in
C#.
> It should work if you change your code to read:
> Page.RegisterClientScriptBlock("adder", "<script>function " +
> "doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value)
+
> " +
> "eval(document.all.TextBox2.value)}</script>");
> or, for more readability, I always for my javascript in a temp variable
> first. Just kinda hard to read otherwise
> string script = "<script>function " +
> "doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value)
+
> " +
> "eval(document.all.TextBox2.value)}</script>"
> Page.RegisterClientScriptBlock("adder", script);
> either way, both of those should work for you.
> -Cliff
>
> "Ivan Demkovitch" <i@.a.b> wrote in message
> news:OfydJF8oDHA.976@.tk2msftngp13.phx.gbl...
> > Hi!
> > I'm trying to add script to the page and place following code in my ascx
> > (control):
> > Page.RegisterClientScriptBlock("adder", "<script>function
> > doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
> > eval(document.all.TextBox2.value)}</script>");
> > It doesn't work giving me all kind of problems...
> > I suspect the problem is with <> charachters.
> > How do I go around this problem?
> > Also, placing this line in code (I use WebMatrix) will mess up all HTML
> > code??
> > Thanks!
I'm trying to add script to the page and place following code in my ascx
(control):
Page.RegisterClientScriptBlock("adder", "<script>function
doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
eval(document.all.TextBox2.value)}</script>");
It doesn't work giving me all kind of problems...
I suspect the problem is with <> charachters.
How do I go around this problem?
Also, placing this line in code (I use WebMatrix) will mess up all HTML
code??
Thanks!If that is the exact line from your code, then it just has to do with how
your formed your string. You cannot insert a line break in a string in C#.
It should work if you change your code to read:
Page.RegisterClientScriptBlock("adder", "<script>function " +
"doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
" +
"eval(document.all.TextBox2.value)}</script>");
or, for more readability, I always for my javascript in a temp variable
first. Just kinda hard to read otherwise
string script = "<script>function " +
"doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
" +
"eval(document.all.TextBox2.value)}</script>"
Page.RegisterClientScriptBlock("adder", script);
either way, both of those should work for you.
-Cliff
"Ivan Demkovitch" <i@.a.b> wrote in message
news:OfydJF8oDHA.976@.tk2msftngp13.phx.gbl...
> Hi!
> I'm trying to add script to the page and place following code in my ascx
> (control):
>
> Page.RegisterClientScriptBlock("adder", "<script>function
> doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
> eval(document.all.TextBox2.value)}</script>");
> It doesn't work giving me all kind of problems...
> I suspect the problem is with <> charachters.
> How do I go around this problem?
> Also, placing this line in code (I use WebMatrix) will mess up all HTML
> code??
> Thanks!
I solved problem...
Actually the problem was in "</script>"
Changed to "<" + "/" + "script>" and it works fine now.
Thanks!
"Cliff Harris" <hersh@.myrealbox.com> wrote in message
news:OkD03L8oDHA.644@.TK2MSFTNGP11.phx.gbl...
> If that is the exact line from your code, then it just has to do with how
> your formed your string. You cannot insert a line break in a string in
C#.
> It should work if you change your code to read:
> Page.RegisterClientScriptBlock("adder", "<script>function " +
> "doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value)
+
> " +
> "eval(document.all.TextBox2.value)}</script>");
> or, for more readability, I always for my javascript in a temp variable
> first. Just kinda hard to read otherwise
> string script = "<script>function " +
> "doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value)
+
> " +
> "eval(document.all.TextBox2.value)}</script>"
> Page.RegisterClientScriptBlock("adder", script);
> either way, both of those should work for you.
> -Cliff
>
> "Ivan Demkovitch" <i@.a.b> wrote in message
> news:OfydJF8oDHA.976@.tk2msftngp13.phx.gbl...
> > Hi!
> > I'm trying to add script to the page and place following code in my ascx
> > (control):
> > Page.RegisterClientScriptBlock("adder", "<script>function
> > doadd(){document.all.TextBox3.value=eval(document. all.TextBox1.value) +
> > eval(document.all.TextBox2.value)}</script>");
> > It doesn't work giving me all kind of problems...
> > I suspect the problem is with <> charachters.
> > How do I go around this problem?
> > Also, placing this line in code (I use WebMatrix) will mess up all HTML
> > code??
> > Thanks!
NewPasswordRegularExpression bug in ChangePassword control
Hi,
I am trying to enforce the following password strength rules:
8 characters minimum
including at least 2 digits
and at least one non-alphanumeric character
Web.config fragment:
<membership defaultProvider="XYZMembershipProvider">
<providers>
<add name="XYZMembershipProvider"
connectionStringName="XYZMembershipConnection"
applicationName="XYZ"
passwordStrengthRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})"
enablePasswordReset="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>
On provider level it works fine, but when I'm trying to place the same Regex
(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})
into NewPasswordRegularExpression property of ChangePassword control,
client-side validation fails for valid passwords that pass server-side
validation when NewPasswordRegularExpression is not filled.
Control markup is below. It looks like javascript-based regex parsing does
not work the same way as its client side peer. Any suggestions?
<asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage
="New password must have at
least 8 characters, including two numbers and one special character"
PasswordHintText="Please enter a password at least 8 characters
long, containing two numbers and one special character"
NewPasswordRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\w){1,})">
</asp:ChangePassword>
Regards,
DmitryOn Feb 8, 8:01=A0pm, "Dmitry Duginov" <d...@.nospam.nospam> wrote:
> Hi,
> I am trying to enforce the following password strength rules:
> 8 characters minimum
> including at least 2 digits
> and at least one non-alphanumeric character
> Web.config fragment:
> =A0 <membership defaultProvider=3D"XYZMembershipProvider">
> =A0 =A0<providers>
> =A0 =A0 =A0 =A0 <add name=3D"XYZMembershipProvider"
> =A0 =A0 =A0 =A0 connectionStringName=3D"XYZMembershipConnection"
> =A0 =A0 =A0 =A0 applicationName=3D"XYZ"
> =A0 =A0 =A0 =A0 passwordStrengthRegularExpression=3D"(?=3D.{8,})(?=3D(.*\d=[/color
]
){2,})(?=3D(.*\W){1,})"
> =A0 =A0 =A0 =A0 enablePasswordReset=3D"false"
> =A0 =A0 =A0 =A0 requiresUniqueEmail=3D"true"
> =A0 =A0 =A0 =A0 passwordFormat=3D"Hashed"
> =A0 =A0 =A0 =A0 type=3D"System.Web.Security.SqlMembershipProvider"/>
> =A0 =A0</providers>
> =A0 </membership>
> On provider level it works fine, but when I'm trying to place the same Reg=[/color
]
ex
> (?=3D.{8,})(?=3D(.*\d){2,})(?=3D(.*\W){1,})
> into NewPasswordRegularExpression property of ChangePassword control,
> client-side validation fails for valid passwords that pass server-side
> validation when NewPasswordRegularExpression is not filled.
> Control markup is below. It looks like javascript-based regex parsing does=[/color
]
> not work the same way as its client side peer. Any suggestions?
> =A0 =A0 <asp:ChangePassword ID=3D"ChangePassword1" runat=3D"server"
> =A0 =A0 =A0 =A0 NewPasswordRegularExpressionErrorMessage
=3D"New password m=[/color
]
ust have at
> least 8 characters, including two numbers and one special character"
> =A0 =A0 =A0 =A0 PasswordHintText=3D"Please enter a password at least 8 cha=[/color
]
racters
> long, containing two numbers and one special character"
> =A0 =A0 =A0 =A0 NewPasswordRegularExpression=3D"(?=3D.{8,})(?=3D(.*\d){2,}=[/color
]
)(?=3D(.*\w){1,})">
> =A0 =A0 </asp:ChangePassword>
> Regards,
> Dmitry
According to MSDN the pattern should look as follows:
NewPasswordRegularExpression =3D '@.\"(?=3D.{8,})(?=3D(.*\d){2,})(?=3D(.*\W)
{1,})'
[url]http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.changepas=[/url
]
sword.newpasswordregularexpression.aspx
Hope this helps
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com...
On Feb 8, 8:01 pm, "Dmitry Duginov" <d...@.nospam.nospam> wrote:
> Hi,
> I am trying to enforce the following password strength rules:
> 8 characters minimum
> including at least 2 digits
> and at least one non-alphanumeric character
> Web.config fragment:
> <membership defaultProvider="XYZMembershipProvider">
> <providers>
> <add name="XYZMembershipProvider"
> connectionStringName="XYZMembershipConnection"
> applicationName="XYZ"
> passwordStrengthRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})"
> enablePasswordReset="false"
> requiresUniqueEmail="true"
> passwordFormat="Hashed"
> type="System.Web.Security.SqlMembershipProvider"/>
> </providers>
> </membership>
> On provider level it works fine, but when I'm trying to place the same
> Regex
> (?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})
> into NewPasswordRegularExpression property of ChangePassword control,
> client-side validation fails for valid passwords that pass server-side
> validation when NewPasswordRegularExpression is not filled.
> Control markup is below. It looks like javascript-based regex parsing does
> not work the same way as its client side peer. Any suggestions?
> <asp:ChangePassword ID="ChangePassword1" runat="server"
> NewPasswordRegularExpressionErrorMessage
="New password must have at
> least 8 characters, including two numbers and one special character"
> PasswordHintText="Please enter a password at least 8 characters
> long, containing two numbers and one special character"
> NewPasswordRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\w){1,})">
> </asp:ChangePassword>
>According to MSDN the pattern should look as follows:
>NewPasswordRegularExpression = '@.\"(?=.{8,})(?=(.*\d){2,})(?=(.*\W)
>{1,})'
>http://msdn2.microsoft.com/en->us/library/system.web.ui.webcontrols.changepassword.
newpasswordregularexpression.aspx
>Hope this helps
Of course it it doesn't. I gave it a try. No difference. If you look
carefully, this regex additionally forces any password to begin with
quotation mark, nothing else. But the validation fails anyway, even if I
specify "password!99.
Let's hear what Microsoft folks think about this...
D.
Hi Dmitry,
As for the CreateUserWizard and its password regex expression, I've
performed some search and it seems there hasn't recorded an existing issue.
For the behavior you mentioned, would you also paste me a test regex
expression and some password patterns? I'd do some tests on my local side
to confirm the behavior.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Dmitry Duginov" <dima@.nospam.nospam>
>References: <eWLRHUoaIHA.5980@.TK2MSFTNGP04.phx.gbl>
<c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
>Subject: Re: NewPasswordRegularExpression bug in ChangePassword control
>Date: Mon, 11 Feb 2008 13:27:28 -0500
>
>"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
>news:c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com...
>On Feb 8, 8:01 pm, "Dmitry Duginov" <d...@.nospam.nospam> wrote:
does
>
>
>
password.newpasswordregularexpression.aspx
>
>Of course it it doesn't. I gave it a try. No difference. If you look
>carefully, this regex additionally forces any password to begin with
>quotation mark, nothing else. But the validation fails anyway, even if I
>specify "password!99.
>Let's hear what Microsoft folks think about this...
>D.
>
>
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
> Hi Dmitry,
> As for the CreateUserWizard and its password regex expression, I've
> performed some search and it seems there hasn't recorded an existing
> issue.
> For the behavior you mentioned, would you also paste me a test regex
> expression and some password patterns? I'd do some tests on my local side
> to confirm the behavior.
Steven, the complete information to reproduce the bug has been included into
original message below. But of course I can copy and paste it, no problem.
<asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage
="New password must have at least 8
characters, including two numbers and one special character"
PasswordHintText="Please enter a password at least 8 characters long,
containing two numbers and one special character"
NewPasswordRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\w){1,})">
</asp:ChangePassword>
Example of the password: password!99
D.
> <c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
>
> does
> password.newpasswordregularexpression.aspx
>
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
MSDN states that:
Client-Side Validation for ASP.NET Server ControlsThere are a few minor
differences associated with client-side validation: ... Client-side regular
expressions differ in small details from the regular ...
But the specific differences between client-side and server side Regex
implementation in ASP.NET is nowhere to be found. Now I recall I used to
have similar problem back in 2003 - the same Regex worked differently on
client and server side. And Microsoft reps told "maybe it will be fixed in
the next version". It's been five years since then...
Could you find out what are those "small, minor differences"?
D.
Hello Dmitry,
> "Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
> news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
> MSDN states that:
> Client-Side Validation for ASP.NET Server ControlsThere are a few
> minor differences associated with client-side validation: ...
> Client-side regular expressions differ in small details from the
> regular ...
> But the specific differences between client-side and server side Regex
> implementation in ASP.NET is nowhere to be found. Now I recall I used
> to have similar problem back in 2003 - the same Regex worked
> differently on client and server side. And Microsoft reps told "maybe
> it will be fixed in the next version". It's been five years since
> then...
> Could you find out what are those "small, minor differences"?
Clientside uses the VBScript/JavaScript/ECMAScript implementation of Regex
(same as the Windows Scripting Host).
Serverside uses the .NET implementation of regex (with the ECMAScript compli
ace
turned on if I'm not mistaking).
For both of these is a separate set of documentation available and I do not
expect these differences to be removed ever/at all, as there are too many
3rd party browsers that have built in support for the same VBScript/JavaScri
pt/ECMAScript
implementation for such a change to work without serious cooperation between
all browser vendors.
I find the following website a handy reference to look up such changes/diffe
rences:
http://www.regular-expressions.info/tools.html
Jesse Houwing
jesse.houwing at sogeti.nl
Hi Dmitry,
As Jesse has mentioned, the difference is something like the script
component's string regex support and .NET's regex support. The site
provided in his message provide some information on regex support of
different tools/platform.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Dmitry Duginov" <dima@.nospam.nospam>
>Subject: Re: NewPasswordRegularExpression bug in ChangePassword control
>Date: Thu, 14 Feb 2008 10:21:28 -0500
>
>"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
>news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
>MSDN states that:
>Client-Side Validation for ASP.NET Server ControlsThere are a few minor
>differences associated with client-side validation: ... Client-side
regular
>expressions differ in small details from the regular ...
>
>But the specific differences between client-side and server side Regex
>implementation in ASP.NET is nowhere to be found. Now I recall I used to
>have similar problem back in 2003 - the same Regex worked differently on
>client and server side. And Microsoft reps told "maybe it will be fixed in
>the next version". It's been five years since then...
>Could you find out what are those "small, minor differences"?
>D.
>
>
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
> Hi Dmitry,
> As for the CreateUserWizard and its password regex expression, I've
> performed some search and it seems there hasn't recorded an existing
> issue.
> For the behavior you mentioned, would you also paste me a test regex
> expression and some password patterns? I'd do some tests on my local side
> to confirm the behavior.
Steven, it's been two w
s.
Did you get anything related to this issue?
D.
> --
> <c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
>
> does
> password.newpasswordregularexpression.aspx
>
Hi Dmitry,
Sorry for keep you waiting. I've done some further research previouly and
haven't got any useful information so far. I'd like to involve some further
resource to help you on this issue. Would you send me a mail offline
through the following address:
"stcheng"+"@."+"microsoft.com"
I'll request some further information from you so as to allocate further
resource to help you.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Dmitry Duginov" <dima@.nospam.nospam>
>References: <eWLRHUoaIHA.5980@.TK2MSFTNGP04.phx.gbl>
<c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
<uXjUBvNbIHA.5976@.TK2MSFTNGP05.phx.gbl>
<sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: NewPasswordRegularExpression bug in ChangePassword control
>Date: Tue, 26 Feb 2008 12:08:10 -0500
>
>"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
>news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
>Steven, it's been two w
s.
>Did you get anything related to this issue?
>D.
>
passwordStrengthRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})"
ge
>
>
I am trying to enforce the following password strength rules:
8 characters minimum
including at least 2 digits
and at least one non-alphanumeric character
Web.config fragment:
<membership defaultProvider="XYZMembershipProvider">
<providers>
<add name="XYZMembershipProvider"
connectionStringName="XYZMembershipConnection"
applicationName="XYZ"
passwordStrengthRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})"
enablePasswordReset="false"
requiresUniqueEmail="true"
passwordFormat="Hashed"
type="System.Web.Security.SqlMembershipProvider"/>
</providers>
</membership>
On provider level it works fine, but when I'm trying to place the same Regex
(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})
into NewPasswordRegularExpression property of ChangePassword control,
client-side validation fails for valid passwords that pass server-side
validation when NewPasswordRegularExpression is not filled.
Control markup is below. It looks like javascript-based regex parsing does
not work the same way as its client side peer. Any suggestions?
<asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage
="New password must have at
least 8 characters, including two numbers and one special character"
PasswordHintText="Please enter a password at least 8 characters
long, containing two numbers and one special character"
NewPasswordRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\w){1,})">
</asp:ChangePassword>
Regards,
DmitryOn Feb 8, 8:01=A0pm, "Dmitry Duginov" <d...@.nospam.nospam> wrote:
> Hi,
> I am trying to enforce the following password strength rules:
> 8 characters minimum
> including at least 2 digits
> and at least one non-alphanumeric character
> Web.config fragment:
> =A0 <membership defaultProvider=3D"XYZMembershipProvider">
> =A0 =A0<providers>
> =A0 =A0 =A0 =A0 <add name=3D"XYZMembershipProvider"
> =A0 =A0 =A0 =A0 connectionStringName=3D"XYZMembershipConnection"
> =A0 =A0 =A0 =A0 applicationName=3D"XYZ"
> =A0 =A0 =A0 =A0 passwordStrengthRegularExpression=3D"(?=3D.{8,})(?=3D(.*\d=[/color
]
){2,})(?=3D(.*\W){1,})"
> =A0 =A0 =A0 =A0 enablePasswordReset=3D"false"
> =A0 =A0 =A0 =A0 requiresUniqueEmail=3D"true"
> =A0 =A0 =A0 =A0 passwordFormat=3D"Hashed"
> =A0 =A0 =A0 =A0 type=3D"System.Web.Security.SqlMembershipProvider"/>
> =A0 =A0</providers>
> =A0 </membership>
> On provider level it works fine, but when I'm trying to place the same Reg=[/color
]
ex
> (?=3D.{8,})(?=3D(.*\d){2,})(?=3D(.*\W){1,})
> into NewPasswordRegularExpression property of ChangePassword control,
> client-side validation fails for valid passwords that pass server-side
> validation when NewPasswordRegularExpression is not filled.
> Control markup is below. It looks like javascript-based regex parsing does=[/color
]
> not work the same way as its client side peer. Any suggestions?
> =A0 =A0 <asp:ChangePassword ID=3D"ChangePassword1" runat=3D"server"
> =A0 =A0 =A0 =A0 NewPasswordRegularExpressionErrorMessage
=3D"New password m=[/color
]
ust have at
> least 8 characters, including two numbers and one special character"
> =A0 =A0 =A0 =A0 PasswordHintText=3D"Please enter a password at least 8 cha=[/color
]
racters
> long, containing two numbers and one special character"
> =A0 =A0 =A0 =A0 NewPasswordRegularExpression=3D"(?=3D.{8,})(?=3D(.*\d){2,}=[/color
]
)(?=3D(.*\w){1,})">
> =A0 =A0 </asp:ChangePassword>
> Regards,
> Dmitry
According to MSDN the pattern should look as follows:
NewPasswordRegularExpression =3D '@.\"(?=3D.{8,})(?=3D(.*\d){2,})(?=3D(.*\W)
{1,})'
[url]http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.changepas=[/url
]
sword.newpasswordregularexpression.aspx
Hope this helps
"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
news:c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com...
On Feb 8, 8:01 pm, "Dmitry Duginov" <d...@.nospam.nospam> wrote:
> Hi,
> I am trying to enforce the following password strength rules:
> 8 characters minimum
> including at least 2 digits
> and at least one non-alphanumeric character
> Web.config fragment:
> <membership defaultProvider="XYZMembershipProvider">
> <providers>
> <add name="XYZMembershipProvider"
> connectionStringName="XYZMembershipConnection"
> applicationName="XYZ"
> passwordStrengthRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})"
> enablePasswordReset="false"
> requiresUniqueEmail="true"
> passwordFormat="Hashed"
> type="System.Web.Security.SqlMembershipProvider"/>
> </providers>
> </membership>
> On provider level it works fine, but when I'm trying to place the same
> Regex
> (?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})
> into NewPasswordRegularExpression property of ChangePassword control,
> client-side validation fails for valid passwords that pass server-side
> validation when NewPasswordRegularExpression is not filled.
> Control markup is below. It looks like javascript-based regex parsing does
> not work the same way as its client side peer. Any suggestions?
> <asp:ChangePassword ID="ChangePassword1" runat="server"
> NewPasswordRegularExpressionErrorMessage
="New password must have at
> least 8 characters, including two numbers and one special character"
> PasswordHintText="Please enter a password at least 8 characters
> long, containing two numbers and one special character"
> NewPasswordRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\w){1,})">
> </asp:ChangePassword>
>According to MSDN the pattern should look as follows:
>NewPasswordRegularExpression = '@.\"(?=.{8,})(?=(.*\d){2,})(?=(.*\W)
>{1,})'
>http://msdn2.microsoft.com/en->us/library/system.web.ui.webcontrols.changepassword.
newpasswordregularexpression.aspx
>Hope this helps
Of course it it doesn't. I gave it a try. No difference. If you look
carefully, this regex additionally forces any password to begin with
quotation mark, nothing else. But the validation fails anyway, even if I
specify "password!99.
Let's hear what Microsoft folks think about this...
D.
Hi Dmitry,
As for the CreateUserWizard and its password regex expression, I've
performed some search and it seems there hasn't recorded an existing issue.
For the behavior you mentioned, would you also paste me a test regex
expression and some password patterns? I'd do some tests on my local side
to confirm the behavior.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Dmitry Duginov" <dima@.nospam.nospam>
>References: <eWLRHUoaIHA.5980@.TK2MSFTNGP04.phx.gbl>
<c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
>Subject: Re: NewPasswordRegularExpression bug in ChangePassword control
>Date: Mon, 11 Feb 2008 13:27:28 -0500
>
>"Alexey Smirnov" <alexey.smirnov@.gmail.com> wrote in message
>news:c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com...
>On Feb 8, 8:01 pm, "Dmitry Duginov" <d...@.nospam.nospam> wrote:
does
>
>
>
password.newpasswordregularexpression.aspx
>
>Of course it it doesn't. I gave it a try. No difference. If you look
>carefully, this regex additionally forces any password to begin with
>quotation mark, nothing else. But the validation fails anyway, even if I
>specify "password!99.
>Let's hear what Microsoft folks think about this...
>D.
>
>
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
> Hi Dmitry,
> As for the CreateUserWizard and its password regex expression, I've
> performed some search and it seems there hasn't recorded an existing
> issue.
> For the behavior you mentioned, would you also paste me a test regex
> expression and some password patterns? I'd do some tests on my local side
> to confirm the behavior.
Steven, the complete information to reproduce the bug has been included into
original message below. But of course I can copy and paste it, no problem.
<asp:ChangePassword ID="ChangePassword1" runat="server"
NewPasswordRegularExpressionErrorMessage
="New password must have at least 8
characters, including two numbers and one special character"
PasswordHintText="Please enter a password at least 8 characters long,
containing two numbers and one special character"
NewPasswordRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\w){1,})">
</asp:ChangePassword>
Example of the password: password!99
D.
> <c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
>
> does
> password.newpasswordregularexpression.aspx
>
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
MSDN states that:
Client-Side Validation for ASP.NET Server ControlsThere are a few minor
differences associated with client-side validation: ... Client-side regular
expressions differ in small details from the regular ...
But the specific differences between client-side and server side Regex
implementation in ASP.NET is nowhere to be found. Now I recall I used to
have similar problem back in 2003 - the same Regex worked differently on
client and server side. And Microsoft reps told "maybe it will be fixed in
the next version". It's been five years since then...
Could you find out what are those "small, minor differences"?
D.
Hello Dmitry,
> "Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
> news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
> MSDN states that:
> Client-Side Validation for ASP.NET Server ControlsThere are a few
> minor differences associated with client-side validation: ...
> Client-side regular expressions differ in small details from the
> regular ...
> But the specific differences between client-side and server side Regex
> implementation in ASP.NET is nowhere to be found. Now I recall I used
> to have similar problem back in 2003 - the same Regex worked
> differently on client and server side. And Microsoft reps told "maybe
> it will be fixed in the next version". It's been five years since
> then...
> Could you find out what are those "small, minor differences"?
Clientside uses the VBScript/JavaScript/ECMAScript implementation of Regex
(same as the Windows Scripting Host).
Serverside uses the .NET implementation of regex (with the ECMAScript compli
ace
turned on if I'm not mistaking).
For both of these is a separate set of documentation available and I do not
expect these differences to be removed ever/at all, as there are too many
3rd party browsers that have built in support for the same VBScript/JavaScri
pt/ECMAScript
implementation for such a change to work without serious cooperation between
all browser vendors.
I find the following website a handy reference to look up such changes/diffe
rences:
http://www.regular-expressions.info/tools.html
Jesse Houwing
jesse.houwing at sogeti.nl
Hi Dmitry,
As Jesse has mentioned, the difference is something like the script
component's string regex support and .NET's regex support. The site
provided in his message provide some information on regex support of
different tools/platform.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Dmitry Duginov" <dima@.nospam.nospam>
>Subject: Re: NewPasswordRegularExpression bug in ChangePassword control
>Date: Thu, 14 Feb 2008 10:21:28 -0500
>
>"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
>news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
>MSDN states that:
>Client-Side Validation for ASP.NET Server ControlsThere are a few minor
>differences associated with client-side validation: ... Client-side
regular
>expressions differ in small details from the regular ...
>
>But the specific differences between client-side and server side Regex
>implementation in ASP.NET is nowhere to be found. Now I recall I used to
>have similar problem back in 2003 - the same Regex worked differently on
>client and server side. And Microsoft reps told "maybe it will be fixed in
>the next version". It's been five years since then...
>Could you find out what are those "small, minor differences"?
>D.
>
>
"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
> Hi Dmitry,
> As for the CreateUserWizard and its password regex expression, I've
> performed some search and it seems there hasn't recorded an existing
> issue.
> For the behavior you mentioned, would you also paste me a test regex
> expression and some password patterns? I'd do some tests on my local side
> to confirm the behavior.
Steven, it's been two w
Did you get anything related to this issue?
D.
> --
> <c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
>
> does
> password.newpasswordregularexpression.aspx
>
Hi Dmitry,
Sorry for keep you waiting. I've done some further research previouly and
haven't got any useful information so far. I'd like to involve some further
resource to help you on this issue. Would you send me a mail offline
through the following address:
"stcheng"+"@."+"microsoft.com"
I'll request some further information from you so as to allocate further
resource to help you.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--
>From: "Dmitry Duginov" <dima@.nospam.nospam>
>References: <eWLRHUoaIHA.5980@.TK2MSFTNGP04.phx.gbl>
<c23f5daa-905b-41bb-86bb-b6214ec25970@.q77g2000hsh.googlegroups.com>
<uXjUBvNbIHA.5976@.TK2MSFTNGP05.phx.gbl>
<sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: NewPasswordRegularExpression bug in ChangePassword control
>Date: Tue, 26 Feb 2008 12:08:10 -0500
>
>"Steven Cheng[MSFT]" <stcheng@.online.microsoft.com> wrote in message
>news:sryMJrgbIHA.360@.TK2MSFTNGHUB02.phx.gbl...
>Steven, it's been two w
>Did you get anything related to this issue?
>D.
>
passwordStrengthRegularExpression="(?=.{8,})(?=(.*\d){2,})(?=(.*\W){1,})"
ge
>
>
Labels:
asp,
bug,
changepassword,
characters,
control,
digitsand,
enforce,
following,
least,
minimumincluding,
net,
newpasswordregularexpression,
non-alphanumeric,
password,
rules8,
strength
Subscribe to:
Posts (Atom)