Showing posts with label page. Show all posts
Showing posts with label page. Show all posts

Thursday, March 29, 2012

Please answer this question

Please answer this question
You are troubleshooting a deployed Web application and need to change the element to enable tracing on the page. You modify the Web.config file for the application. Which statements correctly describe when the change will be applied and its impact on current users? (Select all that apply.)
0 Current users will be immediately disconnected from the application.
0 Current users will be given a five-minute warning before the Web application is restarted.
0 State data stored in the Application object will be maintained.
0 State data stored in the Session object will be lost.
0 The Web application will be restarted and the configuration file will be read immediately.

Getting others to take your test (or do your homework) for you I see...
tisk tisk.

1) True, but they wont know it till they make a request again.
2) false
3) false
4) false
5) false. It will be "read" on the next request.

Please anyone has confirm message box with yes No buttons in it for asp.net page

Please i am looking for a javascript code to use with confirm message box with two buttons Yes and NO in it.

Thank you very much.How about 'OK' and 'Cancel'?

if that's ok - check out :
http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=confirm
Hello David,
Thank's a lot, I will try the messagebox code.

Please correct my @ Page directive for codebehind asp.net

I have a vbproject called myvbproject, in that i created a class called class1.

I build the solution to it, and it created the class1.dll in its bin directory.

Now, i want to use that class1.dll in my asp.net projects web form.

I am writing the following in my asp.net webform1: It is not working: Can you please correct my @dotnet.itags.org.page directive code.

<%@dotnet.itags.org. Page language="VB" Codebehind="class1" AutoEventWireup="false" Inherits="myvbproject.class1" %

Thank you very much for the help.To use class1 from compiled assembly class1.ddl you should not alter your page directive. Add reference to class1.dll, declare variable and use it.

Please enter a different password

i cant create a user buy going to the page or buy the admin page ...? ...ne ideas

Hello, execuse me, but your question is not understood at all by me. Please clarify your question in details so that we can help you out.

BTW: please use "bye" instead of "buy".

regards

Please fire at this class...

Hi,

To make data-life a little easier, and not having to declare a
SqlConnection on each page, I came up with this Sql-Data-class:

' ----------

using System;
using System.Data;
using System.Data.SqlClient;

namespace MyFirstMaybeLeakyClasses
{
public class Data {

public Data()
{
oConn.Open()
}

private static SqlConnection oConn;

public static SqlConnection Connection {
get {
if (oConn == null)
oConn = new SqlConnection([connectionstring));

if (oConn.State != ConnectionState.Open)
oConn.Open();

return oConn;
}
}
}
}

' ----------

What are the cons of using a SqlConnection like this (as a static)? And
should I use it like this at all?

I understood each user-request will instantiate a new connection, so
multiple readers on the same connection shouldn't be a problem. Or am I
mistaking?
From time to time it throws a SqlException stating multiple
SqlDataReaders are trying to use the same connection. Eventhough I'm
using a DataAdapter... I suspect this happens whenever more that one
user is requesting the page(s).

Finally I have this problem that sometimes it complains it can't get a
connection from the connectionpool. I am closing the connection at the
end of each page. Does a connectionclose take several minutes to fully
terminate the connection or could it be something else?

Thanks in advance!WHOOOA!

Let's... just step away from the keyboard for a moment... What you've
got there is a single connection. Declaring it as static means that it
is shared amongst all instances of that class. If one instance of that
class modifies the connection, all other instances are talking to the
same connection. If someone opens the connection to use in a query,
nobody else can use it.

Why did you do this? Why do you want to declare a SqlConnection on a
page _at all_? Your pages really shouldn't know anything about
SqlConnections or any other of them thar fancy data access classes.
That said, your first sentence gives me hope, Sjaakie: "To make
data-life a little easier, and not having to declare a SqlConnection on
each page, I came up with this Sql-Data-class"

Okay, that's good, really good. Keep your data access code in data
access classes and return business objects from those classes. Accept
business objects as parameters to your save methods. Make sure you're
using try/finally to guarantee the connection is closed like

try
{
cn.open();
cmd.ExecuteNonQuery();
}
finally
{
cn.close();
}

Now your data access code is all nice and neat and out your pages, and
you can use it elsewhere. I'm presuming you can make this data access
class static but I've always been wary of doing so out of sheer
ignorance re:threading (anyone care to enlighten me while we're here?).
I generally use the singleton pattern.
Flinky Wisty Pomm schreef:
> That said, your first sentence gives me hope, Sjaakie: "To make
> data-life a little easier, and not having to declare a SqlConnection on
> each page, I came up with this Sql-Data-class"
> Okay, that's good, really good. Keep your data access code in data
> access classes and return business objects from those classes. Accept
> business objects as parameters to your save methods. Make sure you're
> using try/finally to guarantee the connection is closed like
> try
> {
> cn.open();
> cmd.ExecuteNonQuery();
> }
> finally
> {
> cn.close();
> }
>
> Now your data access code is all nice and neat and out your pages, and
> you can use it elsewhere. I'm presuming you can make this data access
> class static but I've always been wary of doing so out of sheer
> ignorance re:threading (anyone care to enlighten me while we're here?).
> I generally use the singleton pattern.

As you might have noticed, I'm somewhat noob in developing OO-applications.

What I'm trying to achieve here is a Data-class which opens a connection
which can be used throughout the entire page/request and is closed at
the end. To me, this looks faster than opening and closing a connection
for each query.

Can you advice me or perhaps point me to a properly written data-layer
example which generally does what I'm looking for?

Thanks
"Sjaakie" <keep@.secret.it> wrote in message
news:44323b7d$0$11061$e4fe514c@.news.xs4all.nl...

> Can you advice me or perhaps point me to a properly written data-layer
> example which generally does what I'm looking for?

http://aspnet.4guysfromrolla.com/articles/070203-1.aspx
Mark Rae schreef:
> "Sjaakie" <keep@.secret.it> wrote in message
> news:44323b7d$0$11061$e4fe514c@.news.xs4all.nl...
>> Can you advice me or perhaps point me to a properly written data-layer
>> example which generally does what I'm looking for?
> http://aspnet.4guysfromrolla.com/articles/070203-1.aspx

Thanks!

Please fire at this class...

Hi,
To make data-life a little easier, and not having to declare a
SqlConnection on each page, I came up with this Sql-Data-class:
' --
using System;
using System.Data;
using System.Data.SqlClient;
namespace MyFirstMaybeLeakyClasses
{
public class Data {
public Data()
{
oConn.Open()
}
private static SqlConnection oConn;
public static SqlConnection Connection {
get {
if (oConn == null)
oConn = new SqlConnection([connectionstring));
if (oConn.State != ConnectionState.Open)
oConn.Open();
return oConn;
}
}
}
}
' --
What are the cons of using a SqlConnection like this (as a static)? And
should I use it like this at all?
I understood each user-request will instantiate a new connection, so
multiple readers on the same connection shouldn't be a problem. Or am I
mistaking?
From time to time it throws a SqlException stating multiple
SqlDataReaders are trying to use the same connection. Eventhough I'm
using a DataAdapter... I suspect this happens whenever more that one
user is requesting the page(s).
Finally I have this problem that sometimes it complains it can't get a
connection from the connectionpool. I am closing the connection at the
end of each page. Does a connectionclose take several minutes to fully
terminate the connection or could it be something else?
Thanks in advance!WHOOOA!
Let's... just step away from the keyboard for a moment... What you've
got there is a single connection. Declaring it as static means that it
is shared amongst all instances of that class. If one instance of that
class modifies the connection, all other instances are talking to the
same connection. If someone opens the connection to use in a query,
nobody else can use it.
Why did you do this? Why do you want to declare a SqlConnection on a
page _at all_? Your pages really shouldn't know anything about
SqlConnections or any other of them thar fancy data access classes.
That said, your first sentence gives me hope, Sjaakie: "To make
data-life a little easier, and not having to declare a SqlConnection on
each page, I came up with this Sql-Data-class"
Okay, that's good, really good. Keep your data access code in data
access classes and return business objects from those classes. Accept
business objects as parameters to your save methods. Make sure you're
using try/finally to guarantee the connection is closed like
try
{
cn.open();
cmd.ExecuteNonQuery();
}
finally
{
cn.close();
}
Now your data access code is all nice and neat and out your pages, and
you can use it elsewhere. I'm presuming you can make this data access
class static but I've always been wary of doing so out of sheer
ignorance re:threading (anyone care to enlighten me while we're here?).
I generally use the singleton pattern.
Flinky Wisty Pomm schreef:
> That said, your first sentence gives me hope, Sjaakie: "To make
> data-life a little easier, and not having to declare a SqlConnection on
> each page, I came up with this Sql-Data-class"
> Okay, that's good, really good. Keep your data access code in data
> access classes and return business objects from those classes. Accept
> business objects as parameters to your save methods. Make sure you're
> using try/finally to guarantee the connection is closed like
> try
> {
> cn.open();
> cmd.ExecuteNonQuery();
> }
> finally
> {
> cn.close();
> }
>
> Now your data access code is all nice and neat and out your pages, and
> you can use it elsewhere. I'm presuming you can make this data access
> class static but I've always been wary of doing so out of sheer
> ignorance re:threading (anyone care to enlighten me while we're here?).
> I generally use the singleton pattern.
>
As you might have noticed, I'm somewhat noob in developing OO-applications.
What I'm trying to achieve here is a Data-class which opens a connection
which can be used throughout the entire page/request and is closed at
the end. To me, this looks faster than opening and closing a connection
for each query.
Can you advice me or perhaps point me to a properly written data-layer
example which generally does what I'm looking for?
Thanks
"Sjaakie" <keep@.secret.it> wrote in message
news:44323b7d$0$11061$e4fe514c@.news.xs4all.nl...

> Can you advice me or perhaps point me to a properly written data-layer
> example which generally does what I'm looking for?
http://aspnet.4guysfromrolla.com/articles/070203-1.aspx
Mark Rae schreef:
> "Sjaakie" <keep@.secret.it> wrote in message
> news:44323b7d$0$11061$e4fe514c@.news.xs4all.nl...
>
> http://aspnet.4guysfromrolla.com/articles/070203-1.aspx
>
Thanks!

Monday, March 26, 2012

Please guys, help me out !

Guys,
I have a very very basic user control which is
txtEmail
txtPassword
btnLogIn
I'm working on flowlayout mode...i created a complete web page...it collects some data from the user...and finally added aSubmit button.. the page is working perfect...when u click Sumit...as we know..the page will be sumitted...then...i added my very very basic user control at the left of the page ( tables and cells and that stuff) ...run the page...click the Sumbit button (that was working one minute ago) and nothig happens...i tried EVERY THING...and nothing happened...i dont know why the button click event is not being fired !!!
everything is ok...the event handler exists...it is wired wiht on click event in intitalize component function...everything everything is Ok
I'm using VS.NET 2003 (ASP.NET 1.1)
Please guys help me asap
Thanks in advancecan you post some code please...
HTML and code behind
Thanks
Leketje
Please check whether you have handles the IsPostBack event.
The User Control
================
HTML
(%@. Control Language="c#" AutoEventWireup="false" Codebehind="Search.ascx.cs" Inherits="Controls.SearchbyName" TargetSchema="http://schemas.microsoft.com/intellisense/ie5" %)
(HTML)
(HEAD)
(LINK media="all" href="http://links.10026.com/?link=Controls\ControlsStyles.css" type="text/css" rel="stylesheet")
(/HEAD)
(body)
(form name="frmMain")
(table cellSpacing="0" cellPadding="0")
(tr)
(td)
(TABLE cellSpacing="0" cellPadding="0")
(TR)
(TD style="PADDING-LEFT: 4px" vAlign="top")
(asp:TextBox id="txtEmailAddress" Runat="server" Width="120px" CssClass="SRTextBox")(/asp:TextBox) (/TD)
(/TR)
(tr)
(TD style="PADDING-LEFT: 4px" vAlign="top" align="left")
(asp:TextBox id="txtPassword" Runat="server" Width="60px" CssClass="SRTextBox" TextMode="Password")(/asp:TextBox)
(/TD)
(/TR)
(TR)
(TD class="LeftPanelButton" style="PADDING-LEFT: 38px; PADDING-BOTTOM: 5px" align="right" colSpan="2")
(asp:Button id="btnLogin" Runat="server" Text="Login")(/asp:Button)
(/TD)
(/TR)
(/TABLE)
(/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)

Code Behind

namespaceMyNameSpace.Controls

{

using System;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

///<summary>

/// Summary description for SearchbyName.

///</summary>

publicclass SearchbyName : System.Web.UI.UserControl

{

protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;

protected System.Web.UI.WebControls.TextBox txtPassword;

protected System.Web.UI.WebControls.Button btnLogin;

protected System.Web.UI.WebControls.TextBox txtEmailAddress;

protected System.Web.UI.WebControls.TextBox txtName;

privatevoid Page_Load(object sender, System.EventArgs e)

{

if(!IsPostBack)

{

}

}

#region Web Form Designer generated code

overrideprotectedvoid OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}

///<summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

///</summary>

privatevoid InitializeComponent()

{

this.btnLogin.Click +=new System.EventHandler(this.btnLogin_Click);

this.Load +=new System.EventHandler(this.Page_Load);

}

#endregion

privatevoid btnLogin_Click(object sender, System.EventArgs e)

{

Response.Write("Help me please");

}

}

}

The web page
===========
HTML
(%@. Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false" Inherits="WebApplication2.WebForm1" %)
(%@. Register TagPrefix="uc1" TagName="Search" src="http://pics.10026.com/?src=Search.ascx" %)
(!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" )
(HTML)
(HEAD)
(title)WebForm1(/title)
(meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1")
(meta name="CODE_LANGUAGE" Content="C#")
(meta name="vs_defaultClientScript" content="JavaScript")
(meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5")
(/HEAD)
(body)
(form id="Form1" method="post" runat="server")
(table)
(tr)
(td)
(uc1:Search id="Search1" runat="server")(/uc1:Search)
(/td)
(/tr)
(tr)
(td)
(asp:Button id="Button1" runat="server" Text="Button")(/asp:Button)
(/td)
(/tr)
(/table)
(/form)
(/body)
(/HTML)

Code Behind

using System;

using System.Collections;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Web;

using System.Web.SessionState;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Web.UI.HtmlControls;

namespace WebApplication2

{

///<summary>

/// Summary description for WebForm1.

///</summary>

publicclass WebForm1 : System.Web.UI.Page

{

protected System.Web.UI.WebControls.Button Button1;

privatevoid Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

}

#region Web Form Designer generated code

overrideprotectedvoid OnInit(EventArgs e)

{

//

// CODEGEN: This call is required by the ASP.NET Web Form Designer.

//

InitializeComponent();

base.OnInit(e);

}

///<summary>

/// Required method for Designer support - do not modify

/// the contents of this method with the code editor.

///</summary>

privatevoid InitializeComponent()

{

this.Button1.Click +=new System.EventHandler(this.Button1_Click);

this.Load +=new System.EventHandler(this.Page_Load);

}

#endregion

privatevoid Button1_Click(object sender, System.EventArgs e)

{

}

}

}

================
I'm sorry for that HTML Crap...it seems i cant use the editor here !!!
Thanks in advance


Deepasmi, thanks...but the point is ...there is no post back !!!
i'm not waiting the button to do something and it didnt...no...the event is not fired at all !!
thanks

The reason why your button doesn't work is because you are including the <html> tags in your user control again...
The main idea of a user control is to create a HTML template with code behind to be included in the main page which already contains the <HTML><HEAD><BODY> and <FORM> tags.
Remove those tags in your user control and your button should work again.
Good Luck
Leketje


Thanks...thanks ...thanks :D:D:D...thaks Leketje...i passed more than 10 hours trying everything...again..thanks :)

please help

Hi,

Can anyone suggest me some good tools to format my aspx page , my aspx page
in an application is very much poorly formatted,
I can't even figure out some of the ending tags exactly and aspx
code-behind really look bad.( I know the vs.net edit and formatting will do
up to a limit )

Also i am not sure is there any specific format that we should follow in
the aspx code behind like 65 chars per line(something like this).Can any one
point me to a link reg this?

Is there any add ins or some tools , that we can use in vs.net editor , so
that some of the conditions will be applied automatically while we create
the aspx page.

Excuse my english.

Thanks in advance
HariAs far as specific formats, there isn't really any. I don't like line breaks
and I use 3 spaces for indentation..but it's really up to each team to
create it's own standards. If you can't stand horizontal scrolling, then
maybe you should wrap (although, with proper use of CSS, only the most
complex sites, or the smallest monitors, cause a horizontal scroll I find).

Visual Studio 2003 is notorious for messing up your HTML. This is quite
unfortunate and I don't think there's much you can do about it. The 2005
editor is much easier to work with.

Sorry, but I don't think you'll find any automated answer short of working
hard at it.

Karl
--
http://www.openmymind.net/

"Hari" <sivakumar_ani@.yahoo.com> wrote in message
news:ek6gJEePGHA.2696@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Can anyone suggest me some good tools to format my aspx page , my aspx
> page
> in an application is very much poorly formatted,
> I can't even figure out some of the ending tags exactly and aspx
> code-behind really look bad.( I know the vs.net edit and formatting will
> do
> up to a limit )
>
> Also i am not sure is there any specific format that we should follow in
> the aspx code behind like 65 chars per line(something like this).Can any
> one
> point me to a link reg this?
> Is there any add ins or some tools , that we can use in vs.net editor , so
> that some of the conditions will be applied automatically while we create
> the aspx page.
> Excuse my english.
> Thanks in advance
> Hari

Please Help

I am writing a guest book for a web page that I am developing at the moment. The guest book is kept in an access database.

I can get the data out alright and display it, however the problem occurs when the user goes to add a comment.

Everything works fine. The user puts all the info in and then clicks on the submit button. It seems that it works. But when the page refreshes the data is not there.

I think there must be something wrong with the add function.

Could some one please help me out as I am at the end of my witts.

The code is below. Cheers,

Public Function Add(ByVal Author As String, ByVal Email As String, _
ByVal Homepage As String, ByVal State As String, ByVal Comment As String) As Boolean
Dim sql As String = "INSERT INTO Comments (Author, Email, Homepage, State, Comment) "
sql += "VALUES (@dotnet.itags.org.Author, @dotnet.itags.org.Email, @dotnet.itags.org.Homepage, @dotnet.itags.org.State, @dotnet.itags.org.Comment)"
' create a new OleDbCommand and set its params
Dim myCmd As OleDbCommand = New OleDbCommand(sql, _Connection)
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Author", OleDbType.VarChar, 50))
myCmd.Parameters("@dotnet.itags.org.Author").Value = Author.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Email", OleDbType.VarChar, 50))
myCmd.Parameters("@dotnet.itags.org.Email").Value = Email.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Homepage", OleDbType.VarChar, 100))
myCmd.Parameters("@dotnet.itags.org.Homepage").Value = Homepage.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.State", OleDbType.VarChar, 50))
myCmd.Parameters("@dotnet.itags.org.State").Value = State.Trim()
myCmd.Parameters.Add(New OleDbParameter("@dotnet.itags.org.Comment", OleDbType.VarChar))
myCmd.Parameters("@dotnet.itags.org.Comment").Value = EncodeHTMLText(Comment.Trim())
Add = True
myCmd.Connection.Open()
Try
myCmd.ExecuteNonQuery()
Catch e As OleDbException
Add = False
Finally
myCmd.Connection.Close()
End Try
End FunctionHave you tried using ? instead of @.paramname:-

Dim sql As String = "INSERT INTO Comments (Author, Email, Homepage, State, Comment) "
sql &= "VALUES (?, ?, ?, ?, ?)"
I gave up and re wrote the form using ADODB. My code is below. If any one has any ways to improve please tell me.

Thankx for your help....

Dim rs As ADODB.Recordset
rs = New ADODB.Recordset()
rs.CursorType = ADODB.CursorTypeEnum.adOpenKeyset
rs.LockType = ADODB.LockTypeEnum.adLockOptimistic
rs.Open("Comments", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\webspace\myweb.com\db\Guestbook.mdb;Persist Security Info=False;", , , ADODB.CommandTypeEnum.adCmdTable)
rs.AddNew()
rs.Fields(1).Value = Author.Text
rs.Fields(2).Value = Email.Text
rs.Fields(3).Value = Homepage.Text
rs.Fields(4).Value = State.Text
rs.Fields(5).Value = Comment.Text
rs.Update()
rs.Close()
rs = Nothing

please help

Hi,
Can anyone suggest me some good tools to format my aspx page , my aspx page
in an application is very much poorly formatted,
I can't even figure out some of the ending tags exactly and aspx
code-behind really look bad.( I know the vs.net edit and formatting will do
up to a limit )
Also i am not sure is there any specific format that we should follow in
the aspx code behind like 65 chars per line(something like this).Can any one
point me to a link reg this?
Is there any add ins or some tools , that we can use in vs.net editor , so
that some of the conditions will be applied automatically while we create
the aspx page.
Excuse my english.
Thanks in advance
HariAs far as specific formats, there isn't really any. I don't like line breaks
and I use 3 spaces for indentation..but it's really up to each team to
create it's own standards. If you can't stand horizontal scrolling, then
maybe you should wrap (although, with proper use of CSS, only the most
complex sites, or the smallest monitors, cause a horizontal scroll I find).
Visual Studio 2003 is notorious for messing up your HTML. This is quite
unfortunate and I don't think there's much you can do about it. The 2005
editor is much easier to work with.
Sorry, but I don't think you'll find any automated answer short of working
hard at it.
Karl
--
http://www.openmymind.net/
"Hari" <sivakumar_ani@.yahoo.com> wrote in message
news:ek6gJEePGHA.2696@.TK2MSFTNGP14.phx.gbl...
> Hi,
> Can anyone suggest me some good tools to format my aspx page , my aspx
> page
> in an application is very much poorly formatted,
> I can't even figure out some of the ending tags exactly and aspx
> code-behind really look bad.( I know the vs.net edit and formatting will
> do
> up to a limit )
>
> Also i am not sure is there any specific format that we should follow in
> the aspx code behind like 65 chars per line(something like this).Can any
> one
> point me to a link reg this?
> Is there any add ins or some tools , that we can use in vs.net editor , so
> that some of the conditions will be applied automatically while we create
> the aspx page.
> Excuse my english.
> Thanks in advance
> Hari
>
>

Please help

Hello I have created a login page using the login page form. After a user logs in I re-direct the user to the protected page by using the following

FormsAuthentication.RedirectFromLoginPage(UserName.selecteditem.value, true). The user is then redirected to a new page default.aspx. On this page I want unique information related to this users username. How do I do this ? EG it should display only accounts related to this user from the accounts database. How do I pass the username from the Login page to this page? or should I get it from the cookies? If so how?Just need to know how to get the login name from Login.aspx to default.aspx

Thanks

GrantHave you treid giving
Response.Write(user.Identity.Name)?
Test.
Hi!

I would like to know where should one give the Response.Write(user.Identity.Name)?

in the login.aspx or default.aspx file. As it does not work for me both ways.

Thanks
Do you have

 <identity impersonate="true" />
line in your web.config
try giving this and check if you get user name
Hi Sushila,

Thanks for your quick response. I was unable to execute the program and get a runtime error. This stops me from doing anything.

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration
Your help will be appreciated.

Thanks

Sukumar
Are you enclosing this tag within


<system.web>
.....
<identity impersonate="true" />
</system.web>

Even without giving this tag <identity impersonate="true" /> User.Identity.Name works

SuKumar : can u paste the error that is shows when u give
Response.Write(User.Identity.Name)

please help

does anyone know how to make a registration page?

how would I make this kind of page work:

http://www.geocities.com/immortal_skate/register.htm

Daniel T.This is an EXTREMELY broad question. If you wanted to use Forms authentication then ASP.NET takes care of a lot of the redirecting and stuff for you, but it is up to YOU to design whatever forms-based security system you want. If you just want to throw users into a database then your registration page is nothing more than a page that updates the database.

Can you be more specific as to your particular requirements?
the way to do this is to learn how to use ASP.Net...get a book, go through the tutorials on this website and do some work.

John
Ok, from the page I showed, you, I want to:

<form action="http://192.168.0.215/Admin/reg/reg.asp" method="post"
example: %nick% = Nickname321 %pass% password123

so that it looks like:

<!-- INPUT DATARequest.Form( nick ) = NickName321Request.Form( pass ) = password123

not
<!-- INPUT DATARequest.Form( nick ) = %nick%Request.Form( pass ) = %pass%

Please Help

Hi,
I have created one webform1.aspx page on local server (c:\inetpub\wwwroot\mysite\prabodh). it executes without any error. when I upload prabodh folder on the main server in (E:\mysite\prabodh) and i have set the properties for this folder.
Now I am getting the following error when i am trying to access the file from my remote machine.
the error is :
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.

<!-- Web.Config Configuration File --
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration
when i am trying to access same file from the main server then .
the error is :

Server Error in '/prabodh' Application.
------------------------

Server cannot access application directory 'E:\web\mysite\prabodh\'. The directory does not exist or is not accessible because of security settings.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Server cannot access application directory 'E:\web\mysite\prabodh\'. The directory does not exist or is not accessible because of security settings.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[HttpException (0x80004005): Server cannot access application directory 'E:\web\mysite\prabodh\'. The directory does not exist or is not accessible because of security settings.]
System.Web.HttpRuntime.EnsureAccessToApplicationDirectory() +72
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +263

[HttpException (0x80004005): ASP.NET Initialization Error]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +965
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +128

------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

dotnet framwork is installed on the server and web.config file
is also there in the root folder of the application.

And I Gave the local user ASPNET read/excecute permissions to your application directory (E:\web\mysite\prabodh\).

I also made sure that the directory is defined as an application in IIS

can any one tell me why i am getting this message.
Thnx in advance.
Jean PaulAre you sure that you're running with the ASPNET user?
no iam not sure

Please Help - Allow Paging on Grid Properties Builder

Hi,

I'm working on a grid when the database returns ... say 100 rows. I would
like to use the Allow Page in the grid Properties, but don't really know how
to code it right. I copied some code from the help, but it doesn't really
work yet. The compiler complains on the following...

private void InitializeComponent()
{
this.gridLegalEntityEmployee.SelectedIndexChanged += new
System.EventHandler(this.gridLegalEntityEmployee_S electedIndexChanged);
this.gridLegalEntityEmployee.PageIndexChanged += new
System.EventHandler(this.gridLegalEntityEmployee_P ageIndexChanged );

this.Load += new System.EventHandler(this.Page_Load);

}

private void gridLegalEntityEmployee_PageIndexChanged( object source,
System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
{
gridLegalEntityEmployee.CurrentPageIndex = e.NewPageIndex;
gridLegalEntityEmployee.DataBind();
}

=== Error ======
this.gridLegalEntityEmployee_PageIndexChanged =>
'cpNET.WebForm1.gridLegalEntityEmployee_PageIndexC hanged(object,
System.Web.UI.WebControls.DataGridPageChangedEvent Args)' does not match
delegate 'void System.EventHandler(object, System.EventArgs)'

Here is some other sniplet code

================================================== ==============
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
gridLegalEntityEmployee.AllowPaging = true;
gridLegalEntityEmployee.PagerStyle.Mode = PagerMode.NumericPages;
gridLegalEntityEmployee.PagerStyle.PageButtonCount = 15;
gridLegalEntityEmployee.PageSize = 15;

LoadLegalEntityEmployeeList();

if (!Page.IsPostBack)
{
gridLegalEntityEmployee.DataBind();
}
}

private void LoadLegalEntityEmployeeList()
{
LegalEntityEmployee leEmployee = new LegalEntityEmployee();

// Retrieve data from database
gridLegalEntityEmployee.DataSource = leEmployee.SelectAll();

// Bind it to Databind
gridLegalEntityEmployee.DataBind();
}
================================================== ==============

I know there is a stupid mistake I made here, but I just cant't see it. Any
suggestion or recommeded is greatly appreciated. I really appriciate you
guys help.

Thanks a lot.

Eddyyou page index changed event is mapped to the wrong handler
it should be
System.Web.UI.WebControls.DataGridPageChangedEvent Handler instead of
system.eventhandler

"Eddy Soeparmin" <esoeparmin@.clientprofiles.com> wrote in message
news:OyTwWzjSDHA.940@.TK2MSFTNGP11.phx.gbl...
> Hi,
> I'm working on a grid when the database returns ... say 100 rows. I would
> like to use the Allow Page in the grid Properties, but don't really know
how
> to code it right. I copied some code from the help, but it doesn't really
> work yet. The compiler complains on the following...
> private void InitializeComponent()
> {
> this.gridLegalEntityEmployee.SelectedIndexChanged += new
> System.EventHandler(this.gridLegalEntityEmployee_S electedIndexChanged);
> this.gridLegalEntityEmployee.PageIndexChanged += new
> System.EventHandler(this.gridLegalEntityEmployee_P ageIndexChanged );
> this.Load += new System.EventHandler(this.Page_Load);
> }
> private void gridLegalEntityEmployee_PageIndexChanged( object source,
> System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
> {
> gridLegalEntityEmployee.CurrentPageIndex = e.NewPageIndex;
> gridLegalEntityEmployee.DataBind();
> }
> === Error ======
> this.gridLegalEntityEmployee_PageIndexChanged =>
> 'cpNET.WebForm1.gridLegalEntityEmployee_PageIndexC hanged(object,
> System.Web.UI.WebControls.DataGridPageChangedEvent Args)' does not match
> delegate 'void System.EventHandler(object, System.EventArgs)'
> Here is some other sniplet code
> ================================================== ==============
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Put user code to initialize the page here
> gridLegalEntityEmployee.AllowPaging = true;
> gridLegalEntityEmployee.PagerStyle.Mode = PagerMode.NumericPages;
> gridLegalEntityEmployee.PagerStyle.PageButtonCount = 15;
> gridLegalEntityEmployee.PageSize = 15;
> LoadLegalEntityEmployeeList();
> if (!Page.IsPostBack)
> {
> gridLegalEntityEmployee.DataBind();
> }
> }
> private void LoadLegalEntityEmployeeList()
> {
> LegalEntityEmployee leEmployee = new LegalEntityEmployee();
> // Retrieve data from database
> gridLegalEntityEmployee.DataSource = leEmployee.SelectAll();
> // Bind it to Databind
> gridLegalEntityEmployee.DataBind();
> }
> ================================================== ==============
> I know there is a stupid mistake I made here, but I just cant't see it.
Any
> suggestion or recommeded is greatly appreciated. I really appriciate you
> guys help.
> Thanks a lot.
> Eddy

Please help - how to create a Printer Friendly web page...

Dear Experts,
I've got a trouble problem that I need your help. The scenario is the
following:

1) I need to add a "Print" button to my web page;
2) by clicking this button, the web page should be able to print out a
well-formatted web page (printer friendly ). That means, I need to adjust the
printing margins (left, top, right, bottom) programmatically.

I really have no idea on how to achieve this but I know this is a very
typical scenario. Could you please give me some advices? Please help.

Thanks a lot.
TiggerAs long as the targetted browser is IE >= 5 you can use the onbeforeprint
and on afterprint events in javascript
(I found this out yeterday)
I wrote the code below to hide a print button and decrease the width when
the document is printed
Hope this helps,
mortb

<head>
<script language="javascript">
var originalWidth;
function window.onbeforeprint()
{
originalWidth = document.getElementById('_tblResult').style.width;
document.getElementById('_tblResult').style.width = '625px';
document.getElementById('_btnPrint').style.display = 'none';
}
function window.onafterprint()
{
document.getElementById('_tblResult').style.width = originalWidth;
document.getElementById('_btnPrint').style.display = 'inline';
}
</script>
</HEAD
"Tigger" <Tigger@.discussions.microsoft.com> wrote in message
news:C2D9F1F1-954D-448A-A201-BAAA332C866E@.microsoft.com...
> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
> the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
Use a media-specific print stylesheet.
For example, try slapping this in a file called print.css
@.page { 0.75in; }
And putting this line in your HTML
<link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=print.css" media="print"
At this point, you should be able to print from your browser normally. If
you need to initiate printing from a button, you should be able to do
something like this:
<input type="button" value="Print me!" onclick="window.print()"
This article might give you some ideas on other things you can do with this
techinque: http://www.alistapart.com/articles/goingtoprint/
And there's always the CSS reference: http://www.w3.org/TR/CSS21/

"Tigger" wrote:

> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>

Please help - how to create a Printer Friendly web page...

Dear Experts,
I've got a trouble problem that I need your help. The scenario is the
following:
1) I need to add a "Print" button to my web page;
2) by clicking this button, the web page should be able to print out a
well-formatted web page (printer friendly ). That means, I need to adjust th
e
printing margins (left, top, right, bottom) programmatically.
I really have no idea on how to achieve this but I know this is a very
typical scenario. Could you please give me some advices? Please help.
Thanks a lot.
TiggerAs long as the targetted browser is IE >= 5 you can use the onbeforeprint
and on afterprint events in javascript
(I found this out yeterday)
I wrote the code below to hide a print button and decrease the width when
the document is printed
Hope this helps,
mortb
<head>
<script language="javascript">
var originalWidth;
function window.onbeforeprint()
{
originalWidth = document.getElementById('_tblResult').style.width;
document.getElementById('_tblResult').style.width = '625px';
document.getElementById('_btnPrint').style.display = 'none';
}
function window.onafterprint()
{
document.getElementById('_tblResult').style.width = originalWidth;
document.getElementById('_btnPrint').style.display = 'inline';
}
</script>
</HEAD>
"Tigger" <Tigger@.discussions.microsoft.com> wrote in message
news:C2D9F1F1-954D-448A-A201-BAAA332C866E@.microsoft.com...
> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
> the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>
Use a media-specific print stylesheet.
For example, try slapping this in a file called print.css
@.page { 0.75in; }
And putting this line in your HTML
<link rel="stylesheet" type="text/css" href="http://links.10026.com/?link=print.css" media="print">
At this point, you should be able to print from your browser normally. If
you need to initiate printing from a button, you should be able to do
something like this:
<input type="button" value="Print me!" onclick="window.print()">
This article might give you some ideas on other things you can do with this
techinque: http://www.alistapart.com/articles/goingtoprint/
And there's always the CSS reference: http://www.w3.org/TR/CSS21/
"Tigger" wrote:

> Dear Experts,
> I've got a trouble problem that I need your help. The scenario is the
> following:
> 1) I need to add a "Print" button to my web page;
> 2) by clicking this button, the web page should be able to print out a
> well-formatted web page (printer friendly ). That means, I need to adjust
the
> printing margins (left, top, right, bottom) programmatically.
> I really have no idea on how to achieve this but I know this is a very
> typical scenario. Could you please give me some advices? Please help.
> Thanks a lot.
> Tigger
>
>

Please help - Passing credentials to windows integrated authentication

I try to access an asp page in a machine that has windows integrated
authentication turned on.
I use System.Net.Networkcredentials as well as System.Net.Webrequest and
Webresponse.
I receive a response but when I try to use Response.Redirect(), a popup
windows appears asking me for user, password, domain.
Is there a way to pass the credentials to the Reponse.Redirect function so I
do not get prompted for credentials again?
This is the code i use:
Dim objCredentials As New System.Net.NetworkCredential
(strUsername, strPassword, strDomain)
Dim objCache As New System.Net.CredentialCache
objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
Dim objWebRequest As System.Net.WebRequest
Dim objWebResponse As System.Net.WebResponse
try
objWebRequest = System.Net.WebRequest.Create(strURL)
objWebRequest.Credentials = objCache
objWebResponse = objWebRequest.GetResponse()
'I get prompted here
Response.Redirect(strURL, False)
Response.Close()
catch ex as exception
end try
Thank you very muchNo there is not. When you use the WebRequest object on the server, the
server is making the request, passing the network credentials. When you use
Response.Redirect, you are instructing the remote client, to make another
request to the server address you passed it, strURL.
The remote user then makes the request to strURL; the browser will only send
the credentials on the machine the remote user is using. I know of no
workaround.
HTH,
bill
"jadher" <jadher@.excite.com> wrote in message
news:uZVSAz5rEHA.1152@.TK2MSFTNGP11.phx.gbl...
> I try to access an asp page in a machine that has windows integrated
> authentication turned on.
> I use System.Net.Networkcredentials as well as System.Net.Webrequest and
> Webresponse.
> I receive a response but when I try to use Response.Redirect(), a popup
> windows appears asking me for user, password, domain.
> Is there a way to pass the credentials to the Reponse.Redirect function so
I
> do not get prompted for credentials again?
> This is the code i use:
> Dim objCredentials As New System.Net.NetworkCredential
> (strUsername, strPassword, strDomain)
> Dim objCache As New System.Net.CredentialCache
> objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
> Dim objWebRequest As System.Net.WebRequest
> Dim objWebResponse As System.Net.WebResponse
> try
> objWebRequest = System.Net.WebRequest.Create(strURL)
> objWebRequest.Credentials = objCache
> objWebResponse = objWebRequest.GetResponse()
> 'I get prompted here
> Response.Redirect(strURL, False)
> Response.Close()
> catch ex as exception
> end try
> Thank you very much
>

Please help - Passing credentials to windows integrated authentication

I try to access an asp page in a machine that has windows integrated
authentication turned on.

I use System.Net.Networkcredentials as well as System.Net.Webrequest and
Webresponse.

I receive a response but when I try to use Response.Redirect(), a popup
windows appears asking me for user, password, domain.

Is there a way to pass the credentials to the Reponse.Redirect function so I
do not get prompted for credentials again?

This is the code i use:
Dim objCredentials As New System.Net.NetworkCredential
(strUsername, strPassword, strDomain)
Dim objCache As New System.Net.CredentialCache
objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
Dim objWebRequest As System.Net.WebRequest
Dim objWebResponse As System.Net.WebResponse
try
objWebRequest = System.Net.WebRequest.Create(strURL)
objWebRequest.Credentials = objCache
objWebResponse = objWebRequest.GetResponse()

'I get prompted here
Response.Redirect(strURL, False)
Response.Close()
catch ex as exception
end try

Thank you very muchNo there is not. When you use the WebRequest object on the server, the
server is making the request, passing the network credentials. When you use
Response.Redirect, you are instructing the remote client, to make another
request to the server address you passed it, strURL.

The remote user then makes the request to strURL; the browser will only send
the credentials on the machine the remote user is using. I know of no
workaround.

HTH,

bill

"jadher" <jadher@.excite.com> wrote in message
news:uZVSAz5rEHA.1152@.TK2MSFTNGP11.phx.gbl...
> I try to access an asp page in a machine that has windows integrated
> authentication turned on.
> I use System.Net.Networkcredentials as well as System.Net.Webrequest and
> Webresponse.
> I receive a response but when I try to use Response.Redirect(), a popup
> windows appears asking me for user, password, domain.
> Is there a way to pass the credentials to the Reponse.Redirect function so
I
> do not get prompted for credentials again?
> This is the code i use:
> Dim objCredentials As New System.Net.NetworkCredential
> (strUsername, strPassword, strDomain)
> Dim objCache As New System.Net.CredentialCache
> objCache.Add(New Uri(strURL), "Negotiate", objCredentials)
> Dim objWebRequest As System.Net.WebRequest
> Dim objWebResponse As System.Net.WebResponse
> try
> objWebRequest = System.Net.WebRequest.Create(strURL)
> objWebRequest.Credentials = objCache
> objWebResponse = objWebRequest.GetResponse()
> 'I get prompted here
> Response.Redirect(strURL, False)
> Response.Close()
> catch ex as exception
> end try
> Thank you very much

Please help - retrieving session variable before pageload sub

I have the following code where I need to get the data from a session variable before I've done the page load. I can't seem to do this without getting the following message:

Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive.

I am using session variables fine in other parts of the program but I'm reading them after the page load.


<%@dotnet.itags.org.Import Namespace="System.data.SqlClient" %>
<%@dotnet.itags.org.Import Namespace="System.data" %>
<script runat="server">
Dim SQLCmd as string
Dim dbConn = Session("UserConnectionString")
Sub Page_Load
...

Thanks!Just set the enableSessionState to true.

If that dosen't work, just pass the conn string in to the URL, less secure though.
Thanks for the reply! I can't use a querystring in this instance and I've tried putting a PAGE directive with enablesessionstate but it didn't work. The session variable becomes available after the pageload so I think that session state is enabled.

Any more help would be greatly appreciated!

Saturday, March 24, 2012

please help + impersonate problem

Hi

Using this code I am try to imperosnate the user.

I did the sample page using this code, thats working fine. When i try place
this code into my existing application its working fine when I HARD CODED THE
USER NAME AND PASSWORD. if I pass the user name and password as variable
string, the imepersonate got failed.

Please help me.. its very urgent...

http://support.microsoft.com/defaul...B;EN-US;Q306158Hi Bala,

Can you post your code assigning the username and password? It's possible
you are making a minor syntax error or other mistake there. Also, you can
check in debug mode to make sure the username and password being passed are
the same as your hardcoded values.

--

Joshua Mitts
joshrm@.msn.com

"Bala" <Bala@.discussions.microsoft.com> wrote in message
news:A538D982-0140-435F-92A1-15FE30E119FE@.microsoft.com...
> Hi
> Using this code I am try to imperosnate the user.
> I did the sample page using this code, thats working fine. When i try
> place
> this code into my existing application its working fine when I HARD CODED
> THE
> USER NAME AND PASSWORD. if I pass the user name and password as variable
> string, the imepersonate got failed.
> Please help me.. its very urgent...
>
> http://support.microsoft.com/defaul...B;EN-US;Q306158