Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Saturday, March 31, 2012

strange & weird problem in ASP.NET application

I am having a strange problem in my ASP.NET application. When
multiple users access the web site, the changes done by a user gets
reflected in another users session.

I have some global variables declared in a module which I use
throughout the application. Is it problem because of this? If I cant
declare a global variable in a module where else can I declare it
where it cannot be changed when multiple users are accessing the same
variable?

Please somebody help me.

-Shalinthat would be the difference betueen session variables and application
variables
you would need session variables
have a look at the pass variables value between diferent pages thread

hope it helps

eric

"shalin" <shalin@.imagine.co.in> wrote in message
news:2acc1eb4.0402260345.4dd44352@.posting.google.c om...
> I am having a strange problem in my ASP.NET application. When
> multiple users access the web site, the changes done by a user gets
> reflected in another users session.
> I have some global variables declared in a module which I use
> throughout the application. Is it problem because of this? If I cant
> declare a global variable in a module where else can I declare it
> where it cannot be changed when multiple users are accessing the same
> variable?
> Please somebody help me.
> -Shalin

Strange Authentication Issue

I'm trying to get the User.Identity.Name with my intranet application. I'm looking to get the Domain\User. Now, at first this simply did not work...User.Identity.Name would return nada. So then I poked around IIS a bit and I managed to switch the authentication methods. I checked off "Anonymous Access" and checked "Integrated Windows Authentication". After doing so, I was able to retrieve the Domain\user.

Great, dandy, fanny-tastic. Now comes the strange part. Certain users have access to re-open issues, so the powers that be created a new group on the server just for these users. When one of the users that belongs to this group accesses the site, they are prompted for a username and password from windows. Just those users in the group.

I don't have any code on page load that checks what role they're in, so what could I be missing here? I would like to get rid of the logon.

Thanks.

I was having the same problem and I fixed it. First of all I hope thereis some admin folder or the folder which special users are trying tovisit. That folder can have confidential files that are only viewableby special users. Go to IIS and view your project folder. right clickon the Admin folder and select properties and than select directorysecurity tab and uncheck windows authentication and check the Anonymousauthentication . Refresh your page and It should work fine now.


azamsharp wrote:

I was having the same problem and I fixed it. First of all I hope there is some admin folder or the folder which special users are trying to visit. That folder can have confidential files that are only viewable by special users. Go to IIS and view your project folder. right click on the Admin folder and select properties and than select directory security tab and uncheck windows authentication and check the Anonymous authentication . Refresh your page and It should work fine now.

The thing is, I had it set up for Anonymous at first. When it was set up that way, I couldn't retreive the Domain\User with User.Identity.Name. It would return nothing.


Yeah you are right. Strange thing is when I try to view restrictedpages using my University Wireless network I dont see the pop upmessage for the username and password. But when I use my dial upaccount at home I see the pop up.

azamsharp wrote:

Yeah you are right. Strange thing is when I try to view restricted pages using my University Wireless network I dont see the pop up message for the username and password. But when I use my dial up account at home I see the pop up.

Interesting. Sounds like your issue is similar to mine. I figured it out. (Well, my manager really did)

We were navigating to the site using the the full url of the domain, instead of the shorter version. Something like:

http://domain.blah.com/dir

When all we had to do was:

http://domain.blah/dir

So I guess using the .com appeared as if we were outside of the network, and therefore it promted for a username/password.

Thanks for your help and interest in my matter!


Thanks for sharing the solution.

strange authentication dialog

Hi all,
I'm developing a website and deployed on webserver, it always
display an authentication dialog that user must login with valid
Windows user. Would anyone helps to instruct how to prohibit this
dialog?
Some information provides for you:
1) Dev softs:
- VS 2005, ASP.NET 2.0, SQL Server 2005 Enterprise edition
2) Server:
a) Website Directory security:
- Allow anonymous access (IUSR_Server)
- Integrated Windows authentication.
b) OS: Windows 2003 Server.
The particular note is when deplying other Windows 2003 Server PC, it
works fine without any authentication dialog although the configuration
is exactly the same.
Some no - effective solutions:
- Remove "Integrated Windows authentication": result of "you are
unauthorized to ..."
- Add permission for user Evryone, Anonymous Logon, Network Service.
Very appreciated for any hint.
KNCKNC,
You should anyway remove the "Integrated WIndows Authentication"
setting from IIS. Having done that, you should make sure that the
physical directory that you have your website in has permissions for
the Network Service. Thirdly, what kind of authentication have you
specified for your web site (typically a setting in your web.config
file). Try checking that.
- Vaibhav
On Nov 2, 1:25 pm, "KNC" <k...@.glassegg.com> wrote:
> Hi all,
> I'm developing a website and deployed on webserver, it always
> display an authentication dialog that user must login with valid
> Windows user. Would anyone helps to instruct how to prohibit this
> dialog?
> Some information provides for you:
> 1) Dev softs:
> - VS 2005, ASP.NET 2.0, SQL Server 2005 Enterprise edition
> 2) Server:
> a) Website Directory security:
> - Allow anonymous access (IUSR_Server)
> - Integrated Windows authentication.
> b) OS: Windows 2003 Server.
> The particular note is when deplying other Windows 2003 Server PC, it
> works fine without any authentication dialog although the configuration
> is exactly the same.
> Some no - effective solutions:
> - Remove "Integrated Windows authentication": result of "you are
> unauthorized to ..."
> - Add permission for user Evryone, Anonymous Logon, Network Service.
> Very appreciated for any hint.
> KNC
Hi V,
Thanks for your help. But as my message, I already tried to remove
"Integrated Windows authentication" and add user "NETWORK SERVICE" into
user list of my folder of website (under wwwroot) but no effect.
I've just re-tried as your instruction but it is still the same
phenomenon.
FYI, the authentication type of web.config is <authentication
mode="Forms">
Moreover, if I setting the Anonymous user account is a power user
(such as Administrator), it works fine, no authentication dialog at
all.
Would you guys pls give the root cause of this problem?
Thanks in advance,
KNC
V wrote:
> KNC,
> You should anyway remove the "Integrated WIndows Authentication"
> setting from IIS. Having done that, you should make sure that the
> physical directory that you have your website in has permissions for
> the Network Service. Thirdly, what kind of authentication have you
> specified for your web site (typically a setting in your web.config
> file). Try checking that.
> - Vaibhav
> On Nov 2, 1:25 pm, "KNC" <k...@.glassegg.com> wrote:
KNC,
if you have configured Forms authentication in your application, have
you implemented it in your pages? To be honest, I am not entirely sure
why your application is behaving this way (need one those experts to
answer on your thread :) ). However, i am trying to think of all the
things that I do when i setup Forms Authentication based web-app as I
have NEVER faced this problem.
Cheers,
- V
KNC wrote:
> Hi V,
> Thanks for your help. But as my message, I already tried to remove
> "Integrated Windows authentication" and add user "NETWORK SERVICE" into
> user list of my folder of website (under wwwroot) but no effect.
> I've just re-tried as your instruction but it is still the same
> phenomenon.
> FYI, the authentication type of web.config is <authentication
> mode="Forms">
> Moreover, if I setting the Anonymous user account is a power user
> (such as Administrator), it works fine, no authentication dialog at
> all.
> Would you guys pls give the root cause of this problem?
> Thanks in advance,
> KNC
> V wrote:

strange authentication dialog

Hi all,

I'm developing a website and deployed on webserver, it always
display an authentication dialog that user must login with valid
Windows user. Would anyone helps to instruct how to prohibit this
dialog?
Some information provides for you:
1) Dev softs:
- VS 2005, ASP.NET 2.0, SQL Server 2005 Enterprise edition
2) Server:
a) Website Directory security:
- Allow anonymous access (IUSR_Server)
- Integrated Windows authentication.
b) OS: Windows 2003 Server.

The particular note is when deplying other Windows 2003 Server PC, it
works fine without any authentication dialog although the configuration
is exactly the same.
Some no - effective solutions:
- Remove "Integrated Windows authentication": result of "you are
unauthorized to ..."
- Add permission for user Evryone, Anonymous Logon, Network Service.

Very appreciated for any hint.
KNCKNC,

You should anyway remove the "Integrated WIndows Authentication"
setting from IIS. Having done that, you should make sure that the
physical directory that you have your website in has permissions for
the Network Service. Thirdly, what kind of authentication have you
specified for your web site (typically a setting in your web.config
file). Try checking that.

- Vaibhav

On Nov 2, 1:25 pm, "KNC" <k...@.glassegg.comwrote:

Quote:

Originally Posted by

Hi all,
>
I'm developing a website and deployed on webserver, it always
display an authentication dialog that user must login with valid
Windows user. Would anyone helps to instruct how to prohibit this
dialog?
Some information provides for you:
1) Dev softs:
- VS 2005, ASP.NET 2.0, SQL Server 2005 Enterprise edition
2) Server:
a) Website Directory security:
- Allow anonymous access (IUSR_Server)
- Integrated Windows authentication.
b) OS: Windows 2003 Server.
>
The particular note is when deplying other Windows 2003 Server PC, it
works fine without any authentication dialog although the configuration
is exactly the same.
Some no - effective solutions:
- Remove "Integrated Windows authentication": result of "you are
unauthorized to ..."
- Add permission for user Evryone, Anonymous Logon, Network Service.
>
Very appreciated for any hint.
KNC


Hi V,

Thanks for your help. But as my message, I already tried to remove
"Integrated Windows authentication" and add user "NETWORK SERVICE" into
user list of my folder of website (under wwwroot) but no effect.
I've just re-tried as your instruction but it is still the same
phenomenon.
FYI, the authentication type of web.config is <authentication
mode="Forms">
Moreover, if I setting the Anonymous user account is a power user
(such as Administrator), it works fine, no authentication dialog at
all.

Would you guys pls give the root cause of this problem?

Thanks in advance,
KNC

V wrote:

Quote:

Originally Posted by

KNC,
>
You should anyway remove the "Integrated WIndows Authentication"
setting from IIS. Having done that, you should make sure that the
physical directory that you have your website in has permissions for
the Network Service. Thirdly, what kind of authentication have you
specified for your web site (typically a setting in your web.config
file). Try checking that.
>
- Vaibhav
>
On Nov 2, 1:25 pm, "KNC" <k...@.glassegg.comwrote:

Quote:

Originally Posted by

Hi all,

I'm developing a website and deployed on webserver, it always
display an authentication dialog that user must login with valid
Windows user. Would anyone helps to instruct how to prohibit this
dialog?
Some information provides for you:
1) Dev softs:
- VS 2005, ASP.NET 2.0, SQL Server 2005 Enterprise edition
2) Server:
a) Website Directory security:
- Allow anonymous access (IUSR_Server)
- Integrated Windows authentication.
b) OS: Windows 2003 Server.

The particular note is when deplying other Windows 2003 Server PC, it
works fine without any authentication dialog although the configuration
is exactly the same.
Some no - effective solutions:
- Remove "Integrated Windows authentication": result of "you are
unauthorized to ..."
- Add permission for user Evryone, Anonymous Logon, Network Service.

Very appreciated for any hint.
KNC


KNC,

if you have configured Forms authentication in your application, have
you implemented it in your pages? To be honest, I am not entirely sure
why your application is behaving this way (need one those experts to
answer on your thread :) ). However, i am trying to think of all the
things that I do when i setup Forms Authentication based web-app as I
have NEVER faced this problem.

Cheers,
- V

KNC wrote:

Quote:

Originally Posted by

Hi V,
>
Thanks for your help. But as my message, I already tried to remove
"Integrated Windows authentication" and add user "NETWORK SERVICE" into
user list of my folder of website (under wwwroot) but no effect.
I've just re-tried as your instruction but it is still the same
phenomenon.
FYI, the authentication type of web.config is <authentication
mode="Forms">
Moreover, if I setting the Anonymous user account is a power user
(such as Administrator), it works fine, no authentication dialog at
all.
>
Would you guys pls give the root cause of this problem?
>
Thanks in advance,
KNC
>
V wrote:

Quote:

Originally Posted by

KNC,

You should anyway remove the "Integrated WIndows Authentication"
setting from IIS. Having done that, you should make sure that the
physical directory that you have your website in has permissions for
the Network Service. Thirdly, what kind of authentication have you
specified for your web site (typically a setting in your web.config
file). Try checking that.

- Vaibhav

On Nov 2, 1:25 pm, "KNC" <k...@.glassegg.comwrote:

Quote:

Originally Posted by

Hi all,
>
I'm developing a website and deployed on webserver, it always
display an authentication dialog that user must login with valid
Windows user. Would anyone helps to instruct how to prohibit this
dialog?
Some information provides for you:
1) Dev softs:
- VS 2005, ASP.NET 2.0, SQL Server 2005 Enterprise edition
2) Server:
a) Website Directory security:
- Allow anonymous access (IUSR_Server)
- Integrated Windows authentication.
b) OS: Windows 2003 Server.
>
The particular note is when deplying other Windows 2003 Server PC, it
works fine without any authentication dialog although the configuration
is exactly the same.
Some no - effective solutions:
- Remove "Integrated Windows authentication": result of "you are
unauthorized to ..."
- Add permission for user Evryone, Anonymous Logon, Network Service.
>
Very appreciated for any hint.
KNC

strange authentication problem...

hi there,
i've got a website i created, that i've put onto my test server on the web.
I have a login page, that when the user comes to it, it first pops up a
windows authentication dialog box, and i dont know why? i click cancel on it
and the page still works as normal.
How can i remove this, and why is it appearing?
i am also not using any .NET authentication methods or anything..
thanks,you can set authentication mode in Web.config file
<authentication mode="Forms">
<forms name="login" loginUrl="login.aspx" protection="All" />
</authentication>
"Paul M" <milsnips@.hotmail.com> д?
news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> hi there,
> i've got a website i created, that i've put onto my test server on the
web.
> I have a login page, that when the user comes to it, it first pops up a
> windows authentication dialog box, and i dont know why? i click cancel on
it
> and the page still works as normal.
> How can i remove this, and why is it appearing?
> i am also not using any .NET authentication methods or anything..
> thanks,
>
thanks, but this isnt exactly what i am after..
What the problem is that i already have a login page which all works
fine...however i have 3 pages in my web app, that whenever i go to their
URL, they always popup the windows authentication window, when it shouldnt
appear..i have no authentication code for these pages, nor do i want any.
web.config is also set to <authentication mode="None" /> but still no luck.
Paull
"lzh" <lzh@.hotmail.com> wrote in message
news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> you can set authentication mode in Web.config file
> <authentication mode="Forms">
> <forms name="login" loginUrl="login.aspx" protection="All" />
> </authentication>
> "Paul M" <milsnips@.hotmail.com> д?
> news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> web.
on
> it
>
it's really a trouble,i have no ideas about that.
if you have set authentication mode="None", it's will work
try again
<authentication mode="None">
<allow users="?"/>
</authentication>
"Paul M" <milsnips@.hotmail.com> д?
:uLl5APAIEHA.828@.TK2MSFTNGP12.phx.gbl...
> thanks, but this isnt exactly what i am after..
> What the problem is that i already have a login page which all works
> fine...however i have 3 pages in my web app, that whenever i go to their
> URL, they always popup the windows authentication window, when it shouldnt
> appear..i have no authentication code for these pages, nor do i want any.
> web.config is also set to <authentication mode="None" /> but still no
luck.
> Paull
> "lzh" <lzh@.hotmail.com> wrote in message
> news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
<allow roles="Admins"/>
a
> on
>

strange authentication problem...

hi there,

i've got a website i created, that i've put onto my test server on the web.

I have a login page, that when the user comes to it, it first pops up a
windows authentication dialog box, and i dont know why? i click cancel on it
and the page still works as normal.

How can i remove this, and why is it appearing?
i am also not using any .NET authentication methods or anything..

thanks,you can set authentication mode in Web.config file
<authentication mode="Forms">
<forms name="login" loginUrl="login.aspx" protection="All" />
</authentication
"Paul M" <milsnips@.hotmail.com> д?
news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> hi there,
> i've got a website i created, that i've put onto my test server on the
web.
> I have a login page, that when the user comes to it, it first pops up a
> windows authentication dialog box, and i dont know why? i click cancel on
it
> and the page still works as normal.
> How can i remove this, and why is it appearing?
> i am also not using any .NET authentication methods or anything..
> thanks,
thanks, but this isnt exactly what i am after..

What the problem is that i already have a login page which all works
fine...however i have 3 pages in my web app, that whenever i go to their
URL, they always popup the windows authentication window, when it shouldnt
appear..i have no authentication code for these pages, nor do i want any.

web.config is also set to <authentication mode="None" /> but still no luck.

Paull

"coollzh" <coollzh@.hotmail.com> wrote in message
news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> you can set authentication mode in Web.config file
> <authentication mode="Forms">
> <forms name="login" loginUrl="login.aspx" protection="All" />
> </authentication>
> "Paul M" <milsnips@.hotmail.com> д?
> news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > hi there,
> > i've got a website i created, that i've put onto my test server on the
> web.
> > I have a login page, that when the user comes to it, it first pops up a
> > windows authentication dialog box, and i dont know why? i click cancel
on
> it
> > and the page still works as normal.
> > How can i remove this, and why is it appearing?
> > i am also not using any .NET authentication methods or anything..
> > thanks,

strange authentication problem...

hi there,

i've got a website i created, that i've put onto my test server on the web.

I have a login page, that when the user comes to it, it first pops up a
windows authentication dialog box, and i dont know why? i click cancel on it
and the page still works as normal.

How can i remove this, and why is it appearing?
i am also not using any .NET authentication methods or anything..

thanks,you can set authentication mode in Web.config file
<authentication mode="Forms">
<forms name="login" loginUrl="login.aspx" protection="All" />
</authentication
"Paul M" <milsnips@.hotmail.com> д?
news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> hi there,
> i've got a website i created, that i've put onto my test server on the
web.
> I have a login page, that when the user comes to it, it first pops up a
> windows authentication dialog box, and i dont know why? i click cancel on
it
> and the page still works as normal.
> How can i remove this, and why is it appearing?
> i am also not using any .NET authentication methods or anything..
> thanks,
you can set authentication mode in Web.config file
<authentication mode="Forms">
<forms name="login" loginUrl="login.aspx" protection="All" />
</authentication
"Paul M" <milsnips@.hotmail.com> д?
news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> hi there,
> i've got a website i created, that i've put onto my test server on the
web.
> I have a login page, that when the user comes to it, it first pops up a
> windows authentication dialog box, and i dont know why? i click cancel on
it
> and the page still works as normal.
> How can i remove this, and why is it appearing?
> i am also not using any .NET authentication methods or anything..
> thanks,
thanks, but this isnt exactly what i am after..

What the problem is that i already have a login page which all works
fine...however i have 3 pages in my web app, that whenever i go to their
URL, they always popup the windows authentication window, when it shouldnt
appear..i have no authentication code for these pages, nor do i want any.

web.config is also set to <authentication mode="None" /> but still no luck.

Paull

"coollzh" <coollzh@.hotmail.com> wrote in message
news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> you can set authentication mode in Web.config file
> <authentication mode="Forms">
> <forms name="login" loginUrl="login.aspx" protection="All" />
> </authentication>
> "Paul M" <milsnips@.hotmail.com> д?
> news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > hi there,
> > i've got a website i created, that i've put onto my test server on the
> web.
> > I have a login page, that when the user comes to it, it first pops up a
> > windows authentication dialog box, and i dont know why? i click cancel
on
> it
> > and the page still works as normal.
> > How can i remove this, and why is it appearing?
> > i am also not using any .NET authentication methods or anything..
> > thanks,
thanks, but this isnt exactly what i am after..

What the problem is that i already have a login page which all works
fine...however i have 3 pages in my web app, that whenever i go to their
URL, they always popup the windows authentication window, when it shouldnt
appear..i have no authentication code for these pages, nor do i want any.

web.config is also set to <authentication mode="None" /> but still no luck.

Paull

"coollzh" <coollzh@.hotmail.com> wrote in message
news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> you can set authentication mode in Web.config file
> <authentication mode="Forms">
> <forms name="login" loginUrl="login.aspx" protection="All" />
> </authentication>
> "Paul M" <milsnips@.hotmail.com> д?
> news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > hi there,
> > i've got a website i created, that i've put onto my test server on the
> web.
> > I have a login page, that when the user comes to it, it first pops up a
> > windows authentication dialog box, and i dont know why? i click cancel
on
> it
> > and the page still works as normal.
> > How can i remove this, and why is it appearing?
> > i am also not using any .NET authentication methods or anything..
> > thanks,
it's really a trouble,i have no ideas about that.
if you have set authentication mode="None", it's will work
try again
<authentication mode="None"
<allow users="?"/>
</authentication
"Paul M" <milsnips@.hotmail.com> д?
:uLl5APAIEHA.828@.TK2MSFTNGP12.phx.gbl...
> thanks, but this isnt exactly what i am after..
> What the problem is that i already have a login page which all works
> fine...however i have 3 pages in my web app, that whenever i go to their
> URL, they always popup the windows authentication window, when it shouldnt
> appear..i have no authentication code for these pages, nor do i want any.
> web.config is also set to <authentication mode="None" /> but still no
luck.
> Paull
> "coollzh" <coollzh@.hotmail.com> wrote in message
> news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> > you can set authentication mode in Web.config file
> > <authentication mode="Forms">
> > <forms name="login" loginUrl="login.aspx" protection="All" />
<allow roles="Admins"/
> > </authentication>
> > "Paul M" <milsnips@.hotmail.com> д?
> > news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > > hi there,
> > > > i've got a website i created, that i've put onto my test server on the
> > web.
> > > > I have a login page, that when the user comes to it, it first pops up
a
> > > windows authentication dialog box, and i dont know why? i click cancel
> on
> > it
> > > and the page still works as normal.
> > > > How can i remove this, and why is it appearing?
> > > i am also not using any .NET authentication methods or anything..
> > > > thanks,
> >

strange authentication problem...

hi there,

i've got a website i created, that i've put onto my test server on the web.

I have a login page, that when the user comes to it, it first pops up a
windows authentication dialog box, and i dont know why? i click cancel on it
and the page still works as normal.

How can i remove this, and why is it appearing?
i am also not using any .NET authentication methods or anything..

thanks,you can set authentication mode in Web.config file
<authentication mode="Forms">
<forms name="login" loginUrl="login.aspx" protection="All" />
</authentication
"Paul M" <milsnips@.hotmail.com> д?
news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> hi there,
> i've got a website i created, that i've put onto my test server on the
web.
> I have a login page, that when the user comes to it, it first pops up a
> windows authentication dialog box, and i dont know why? i click cancel on
it
> and the page still works as normal.
> How can i remove this, and why is it appearing?
> i am also not using any .NET authentication methods or anything..
> thanks,
thanks, but this isnt exactly what i am after..

What the problem is that i already have a login page which all works
fine...however i have 3 pages in my web app, that whenever i go to their
URL, they always popup the windows authentication window, when it shouldnt
appear..i have no authentication code for these pages, nor do i want any.

web.config is also set to <authentication mode="None" /> but still no luck.

Paull

"coollzh" <coollzh@.hotmail.com> wrote in message
news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> you can set authentication mode in Web.config file
> <authentication mode="Forms">
> <forms name="login" loginUrl="login.aspx" protection="All" />
> </authentication>
> "Paul M" <milsnips@.hotmail.com> д?
> news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > hi there,
> > i've got a website i created, that i've put onto my test server on the
> web.
> > I have a login page, that when the user comes to it, it first pops up a
> > windows authentication dialog box, and i dont know why? i click cancel
on
> it
> > and the page still works as normal.
> > How can i remove this, and why is it appearing?
> > i am also not using any .NET authentication methods or anything..
> > thanks,
thanks, but this isnt exactly what i am after..

What the problem is that i already have a login page which all works
fine...however i have 3 pages in my web app, that whenever i go to their
URL, they always popup the windows authentication window, when it shouldnt
appear..i have no authentication code for these pages, nor do i want any.

web.config is also set to <authentication mode="None" /> but still no luck.

Paull

"coollzh" <coollzh@.hotmail.com> wrote in message
news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> you can set authentication mode in Web.config file
> <authentication mode="Forms">
> <forms name="login" loginUrl="login.aspx" protection="All" />
> </authentication>
> "Paul M" <milsnips@.hotmail.com> д?
> news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > hi there,
> > i've got a website i created, that i've put onto my test server on the
> web.
> > I have a login page, that when the user comes to it, it first pops up a
> > windows authentication dialog box, and i dont know why? i click cancel
on
> it
> > and the page still works as normal.
> > How can i remove this, and why is it appearing?
> > i am also not using any .NET authentication methods or anything..
> > thanks,
it's really a trouble,i have no ideas about that.
if you have set authentication mode="None", it's will work
try again
<authentication mode="None"
<allow users="?"/>
</authentication
"Paul M" <milsnips@.hotmail.com> д?
:uLl5APAIEHA.828@.TK2MSFTNGP12.phx.gbl...
> thanks, but this isnt exactly what i am after..
> What the problem is that i already have a login page which all works
> fine...however i have 3 pages in my web app, that whenever i go to their
> URL, they always popup the windows authentication window, when it shouldnt
> appear..i have no authentication code for these pages, nor do i want any.
> web.config is also set to <authentication mode="None" /> but still no
luck.
> Paull
> "coollzh" <coollzh@.hotmail.com> wrote in message
> news:uy1G0C9HEHA.2300@.tk2msftngp13.phx.gbl...
> > you can set authentication mode in Web.config file
> > <authentication mode="Forms">
> > <forms name="login" loginUrl="login.aspx" protection="All" />
<allow roles="Admins"/
> > </authentication>
> > "Paul M" <milsnips@.hotmail.com> д?
> > news:Oux4bs8HEHA.3200@.TK2MSFTNGP10.phx.gbl...
> > > hi there,
> > > > i've got a website i created, that i've put onto my test server on the
> > web.
> > > > I have a login page, that when the user comes to it, it first pops up
a
> > > windows authentication dialog box, and i dont know why? i click cancel
> on
> > it
> > > and the page still works as normal.
> > > > How can i remove this, and why is it appearing?
> > > i am also not using any .NET authentication methods or anything..
> > > > thanks,
> >

Strange behavior

Hello guys,
I have a strange behaviour in my asp.net web page. My page
contains a datagrid control, which has another nested
datagrid as a user control. It works very well, when the
user expands the + button or closes it with the same
buton. However when I do this several times successively
then suddenly I got the error message:
Object reference not set to an instance of an object.
objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
(0).FindControl("lblInvoiceDate"), Label).Text
When I do a refresh then it sees the label control again.
I am somehow why this is happening. Can somebody
help?
ThanksBy looking at this code, all one could really say is that:
objGetDailyStoreQuantitySold could be Nothing.
e could be Nothing.
e.Item could be Nothing
e.Item.Cells could be Nothing
...
etc.
You'll need to show a little more code or step through with a debugger
to get more details. Know what I mean?
Scott
http://www.OdeToCode.com/blogs/scott/
On Thu, 10 Feb 2005 08:01:10 -0800, "anonymous"
<anonymous@.discussions.microsoft.com> wrote:

>Hello guys,
>I have a strange behaviour in my asp.net web page. My page
>contains a datagrid control, which has another nested
>datagrid as a user control. It works very well, when the
>user expands the + button or closes it with the same
>buton. However when I do this several times successively
>then suddenly I got the error message:
>Object reference not set to an instance of an object.
>objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
>(0).FindControl("lblInvoiceDate"), Label).Text
>
>When I do a refresh then it sees the label control again.
>I am somehow why this is happening. Can somebody
>help?
>Thanks

Strange behavior

Hello guys,

I have a strange behaviour in my asp.net web page. My page
contains a datagrid control, which has another nested
datagrid as a user control. It works very well, when the
user expands the + button or closes it with the same
buton. However when I do this several times successively
then suddenly I got the error message:

Object reference not set to an instance of an object.
objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
(0).FindControl("lblInvoiceDate"), Label).Text

When I do a refresh then it sees the label control again.
I am somehow confused why this is happening. Can somebody
help?

ThanksBy looking at this code, all one could really say is that:

objGetDailyStoreQuantitySold could be Nothing.
e could be Nothing.
e.Item could be Nothing
e.Item.Cells could be Nothing
...
etc.

You'll need to show a little more code or step through with a debugger
to get more details. Know what I mean?

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Thu, 10 Feb 2005 08:01:10 -0800, "anonymous"
<anonymous@.discussions.microsoft.com> wrote:

>Hello guys,
>I have a strange behaviour in my asp.net web page. My page
>contains a datagrid control, which has another nested
>datagrid as a user control. It works very well, when the
>user expands the + button or closes it with the same
>buton. However when I do this several times successively
>then suddenly I got the error message:
>Object reference not set to an instance of an object.
>objGetDailyStoreQuantitySold.StartDate = CType(e.Item.Cells
>(0).FindControl("lblInvoiceDate"), Label).Text
>
>When I do a refresh then it sees the label control again.
>I am somehow confused why this is happening. Can somebody
>help?
>Thanks

Strange Behavior from RequiredFieldValidator (and Two LinkButtons)

We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
RequireFieldValidator. The situation is: the user needs to enter a folder
name in the TextBox and click the first LinkButton (the Create Folder
LinkButton) to create the folder. Then once that's done, they need to click
the second LinkButton (the Next LinkButton) to go to the next page (a
rudimentary wizard).
The RequiredFieldValidator is there to make sure the user enters a folder
name in the TextBox before clicking the first LinkButton (the Create Folder
LinkButton). This all works fine.
What's strange is if the user doesn't enter anything in the TextBox and
clicks the second LinkButton (the Next LinkButton) before clicking the first
LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
the error anyway.
Is this correct behavior? What we want is for the first LinkButton (the
Create Report LinkButton) only to validate that text has been entered in the
TextBox, not the second LinkButton (the Next LinkButton). How can we do
this?Hi JJ,
The function of the requiredfield validator is just to check the txtbox is
having some value or not.
If you want that checking has to be made only for the first link button and
not for the second link button, then specifically you have to inform the
validator as follows.
1. Click the second link button and go to the properties window.
2. Set the cause validation property to False.
So, here after when you are click second link button form will not do any
validations.
Hope this helps you.
Cheers,
Jerome. M
"JJ" wrote:

> We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
> RequireFieldValidator. The situation is: the user needs to enter a folder
> name in the TextBox and click the first LinkButton (the Create Folder
> LinkButton) to create the folder. Then once that's done, they need to cli
ck
> the second LinkButton (the Next LinkButton) to go to the next page (a
> rudimentary wizard).
> The RequiredFieldValidator is there to make sure the user enters a folder
> name in the TextBox before clicking the first LinkButton (the Create Folde
r
> LinkButton). This all works fine.
> What's strange is if the user doesn't enter anything in the TextBox and
> clicks the second LinkButton (the Next LinkButton) before clicking the fir
st
> LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alar
ms
> the error anyway.
> Is this correct behavior? What we want is for the first LinkButton (the
> Create Report LinkButton) only to validate that text has been entered in t
he
> TextBox, not the second LinkButton (the Next LinkButton). How can we do
> this?
>
>

Strange Behavior from RequiredFieldValidator (and Two LinkButtons)

We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
RequireFieldValidator. The situation is: the user needs to enter a folder
name in the TextBox and click the first LinkButton (the Create Folder
LinkButton) to create the folder. Then once that's done, they need to click
the second LinkButton (the Next LinkButton) to go to the next page (a
rudimentary wizard).

The RequiredFieldValidator is there to make sure the user enters a folder
name in the TextBox before clicking the first LinkButton (the Create Folder
LinkButton). This all works fine.

What's strange is if the user doesn't enter anything in the TextBox and
clicks the second LinkButton (the Next LinkButton) before clicking the first
LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
the error anyway.

Is this correct behavior? What we want is for the first LinkButton (the
Create Report LinkButton) only to validate that text has been entered in the
TextBox, not the second LinkButton (the Next LinkButton). How can we do
this?Hi JJ,

The function of the requiredfield validator is just to check the txtbox is
having some value or not.

If you want that checking has to be made only for the first link button and
not for the second link button, then specifically you have to inform the
validator as follows.

1. Click the second link button and go to the properties window.

2. Set the cause validation property to False.

So, here after when you are click second link button form will not do any
validations.

Hope this helps you.

Cheers,

Jerome. M

"JJ" wrote:

> We have an ASP.NET web form with 1 TextBox, 2 LinkButtons, and 1
> RequireFieldValidator. The situation is: the user needs to enter a folder
> name in the TextBox and click the first LinkButton (the Create Folder
> LinkButton) to create the folder. Then once that's done, they need to click
> the second LinkButton (the Next LinkButton) to go to the next page (a
> rudimentary wizard).
> The RequiredFieldValidator is there to make sure the user enters a folder
> name in the TextBox before clicking the first LinkButton (the Create Folder
> LinkButton). This all works fine.
> What's strange is if the user doesn't enter anything in the TextBox and
> clicks the second LinkButton (the Next LinkButton) before clicking the first
> LinkButton (the Create Folder LinkButton), the RequiredFieldValidator alarms
> the error anyway.
> Is this correct behavior? What we want is for the first LinkButton (the
> Create Report LinkButton) only to validate that text has been entered in the
> TextBox, not the second LinkButton (the Next LinkButton). How can we do
> this?
>

Strange behavior with activate user in windows 2003 server

Hi,

I code an activate user process who works very great on my computer but when i put it on my server (win server 2003 / SQL server 2005) it doesn't validate (isapproved=true) the user.

Activate.aspx.vb :

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim UserNameEmail As String = Request.QueryString("useremail")
Dim Username As String = Membership.GetUserNameByEmail(UserNameEmail)

If Not String.IsNullOrEmpty(UserNameEmail) Then
Dim usr As MembershipUser = Membership.GetUser(Username)
If Not Nothing Is usr Then
usr.IsApproved = True
Membership.UpdateUser(usr)
Response.Redirect("activate_success.aspx")
Else
Response.Redirect("activate_error.aspx")
End If
Else
Response.Redirect("activate_error.aspx")
End If
Else
Response.Redirect("activate_error.aspx")
End If
End Sub


I don't know why? Someone have an idea please?

Hi,

I need to mention that if i use the UserID for the activation it works:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim UserName As String = Request.Params("USERID")
Dim providerUserKey As Guid = New Guid(UserName)

If Not String.IsNullOrEmpty(UserName) Then
Dim usr As MembershipUser = Membership.GetUser(providerUserKey)
If Not Nothing Is usr Then
usr.IsApproved = True
Membership.UpdateUser(usr)
Response.Redirect("activate_success.aspx")
Else
Response.Redirect("activate_error.aspx")
End If
Else
Response.Redirect("activate_error.aspx")
End If
Else
Response.Redirect("activate_error.aspx")
End If
End Sub

But i want to activate the user with passing only his email and not his UserID because USerID is too confidential...


Ok i understand why it is not working...

Many users can have the same email so the database doesn't know which user to pick...

I will think of that...

Wednesday, March 28, 2012

Strange behaviour of Dropdownlists..

Hi All,
We have an application page that has several dropdownlists on it. Data enter
ed by the user is extracted from these dropdownlists is being stored in a MS
SQL database.
The problem is that the page works fine 99% of the time. However, there have
been cases where the selection on all dropdownlists has been reset to the f
irst item on the list. We have not been able to reproduce this error on our
development environment, bu
t the error continues to occur, albeit rarely.
Any inputs on this matter is greatly appreciated.
Thanks and Regards,
VamshiThank you for your response, Bruce.
However, I do not think that this error has anything to do with the use of t
he keyboard for input. What actually happens is that *all* dropdowns are bei
ng reinitialized to the first element on the list.
Just to be sure, I did try messing with the keyboard when the page was being
posted back, but was still unable to reproduce the error. Let me know if I'
m missing something.
Thanks and Regards,
Vamshi
-- bruce barker wrote: --
if any of the dropdowns are set for postback, you will have trouble if the
user uses the keyboard for entry (uparrow, drownarrow). you need to add
client code to disable the dropdown until the postback has completed.
-- bruce (sqlwork.com)
"Vamshi" <vamshi.ponnapalli@.analog.com> wrote in message
news:A4E6F089-8F9D-464A-B4CD-C5DB7D066B00@.microsoft.com...
> Hi All,
entered by the user is extracted from these dropdownlists is being stored in
a MS SQL database.
have been cases where the selection on all dropdownlists has been reset to
the first item on the list. We have not been able to reproduce this error on
our development environment, but the error continues to occur, albeit
rarely.
> Vamshi

Monday, March 26, 2012

Strange error - Permissions and web.config?

I've added additional security to a sub folder in a web site where the user must provide a User ID and PWD to access a certain folder. It's not allowing anonymous access to the folder as designed.

Here is the folder: http://www.drpt.virginia.gov/ftp/blabaugh/

And the UID and PWD is both "labaugh-user".

Check out the error message once you log in. I've never seen that before. Any ideas? I searched this forum but didn't have any luck finding the solution.

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

Access denied to 'E:\websites\drpt2004\ftp\blabaugh\web.config'. Failed to start monitoring file changes. "

HUH?

Thanks!after googling a bit, it seems you should look at your authentication. Are you using impersonation? Does the ASPNET account have permissions to the directory you application resides in?

<a href='http://support.microsoft.com/default.aspx?kbid=317955'> KB Article 317955 </a>
Not doing any impersonation but that article helped. I added ASPNET account and it fixed it. Thanks!

Saturday, March 24, 2012

strange error in asp.net application using Web user control

Hi,

I made a webuser control which is a menu with some links. Now iam trying to add an asp drop downlist in the webuser control an it is giving me this error:

Control 'Menu1_DropDownList14' of type 'DropDownList' must be placed inside a form tag with runat=server.

I know that webuser control does not consists of the FORM tag so why is it giving me error:

Here is my code :

<%@dotnet.itags.org. Control Language="c#" AutoEventWireup="false" Codebehind="menu.ascx.cs" Inherits="Hospital.menu" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%
<DIV style="WIDTH: 170px; POSITION: relative; HEIGHT: 179px" ms_positioning="GridLayout"
<asp:HyperLink id="HyperLink1" style="Z-INDEX: 101; LEFT: 17px; POSITION: absolute; TOP: 11px" runat="server" ForeColor="ActiveCaptionText" NavigateUrl="testaspx.aspx" Font-Bold="True"
<span class="NormalBold">Add Patient</span></asp:HyperLink
<asp:HyperLink id="HyperLink2" style="Z-INDEX: 102; LEFT: 16px; POSITION: absolute; TOP: 94px" runat="server" ForeColor="ActiveCaption" NavigateUrl="AddVolunteer.aspx"
<span class="NormalBold">Add Volunteer</span></asp:HyperLink
<asp:HyperLink id="HyperLink3" style="Z-INDEX: 103; LEFT: 9px; POSITION: absolute; TOP: 129px" ForeColor="ActiveCaption" runat="server" NavigateUrl="VolunteerList.aspx"
<span class="NormalBold">List of Volunteers</span></asp:HyperLink
<asp:DropDownList id="DropDownList14" style="Z-INDEX: 104; LEFT: 24px; POSITION: absolute; TOP: 51px" Runat =server ></asp:DropDownList></DIV
------------------------You need to place the UserControl inside a form tag with RunAt=Server.
You need to place your User Control (ASCX) inside an ASPX page and, as Douglas points out, that ASPX page must wrap your user control inside <form runat="server"> ... </form> tags.

Like this:

<%@. Page Language="VB" Debug="true" %>
<%@. Register TagPrefix="my" TagName="UserControl" src="http://pics.10026.com/?src=mycontrol.ascx" %>
<html>
<head>
</head>
<body>
<form runat="server">
<my:UserControl id="myUserControl" runat="server"></my:UserControl>
</form>
</body>
</html>

Thanks a lot

Strange event behavior with check boxes

I've designed a gridview that contains a template field with an
unbound checkbox, allowing the user to select certain rows for further
action.
I am capturing the CheckedChanged event in order to set the grid's
SelectedIndex equal to the row whose check box was checked or
unchecked. However, for some strange reason when I click a checkbox
the CheckedChanged event fires for every checked checkbox in the grid,
from top to bottom. Consequently, the SelectedIndex always ends up
being the last checked row.
Can anyone shed some light on this behavior?
-- HansOn Jul 26, 9:23 pm, Froefel <hansdeschry...@.gmail.com> wrote:
> I've designed a gridview that contains a template field with an
> unbound checkbox, allowing the user to select certain rows for further
> action.
> I am capturing the CheckedChanged event in order to set the grid's
> SelectedIndex equal to the row whose check box was checked or
> unchecked. However, for some strange reason when I click a checkbox
> the CheckedChanged event fires for every checked checkbox in the grid,
> from top to bottom. Consequently, the SelectedIndex always ends up
> being the last checked row.
> Can anyone shed some light on this behavior?
> -- Hans
Hi...
can you please provide some code sample...
Masudur

strange event postback behaviour in dynamically created usercontrol

hi,
i have an aspx page which dynamically loads a user control and adds it
to a placeholder. the control is recreated and added to the
placeholder for postbacks as well.
the user control contains a datagrid and some buttons and textboxes.
the button events fire correctly and execute their code. however, the
datagrid events fire a postback, and execute Page_load in the
usercontrol, but the Item_Command code is not executed. the code to
add events to the datagrid is in InitialiseComponent.

i have the datagrid binding in UserControl_PreRender, so that it is
bound between postbacks.

can anyone suggest why the postback is happening without the
ItemCommand event happening? i've verified this with VS debugging.

thanks
timHi Tim_Mac,

Welcome to ASP.NET newsgroup.
From your description, you've a UserControl which contains some button and
a DataGrid on it, the datagrid is subscribing some postback
events(ItemCommand). And in one of your asp.net page, you dynamically load
the usercontrol and add it on your page. However, you found the ItemCommand
of the datagrid(in usercontrol) always not fire, yes?

Based on my experience, such event handler not executing problem is likely
caused by the following things:
1. For dynamic loaded(created) controls, make sure we add them in the
Page_Init or Page_Load every time the page is requested(IsPostback or
not...).

2. For control's event handler, we also need to register them in Init or
Load event. Also, for template databound controls such as DataGrid or
DataList, we should avoid rebinding them with different datasource before
processing postback event since the event may depend on the original binded
datas.

As for your condition, since some other controls (such as button)'s event
handler execute correctly. I think the problem is likely within the
UserControl itself. Would you try registering your datagrid's ItemCommand
handler in the usercontrol's ascx template instead of programmatically
register in codebehind? Just like
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...
If you feel it convenient, I suggest you try build a simpler usercontrol
(contains a datagrid) so as to repro the problem and send it to me. Then I
can do some researchs on my side.

In addition, if you feel necessary, I can also generate a test page on my
side and let you have a compare to see whehter there are any difference.

Please feel free to let me know if you have any questions. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
hi Steven,
thank you for your most helpful reply.
i have got it working now, and will attempt to explain how and why for
future reference.

my aspx page contaings the following in Page_Load:
Modules.SportsLadder ladder =
this.LoadControl("Modules/SportsLadder.ascx") as Modules.SportsLadder;
this.serverForm.Controls.Add(ladder);

the user control is loaded regardless of whether a postback has taken
place or not.
the user control then contains a call to if(!IsPostBack) BindGrid() in
the Page_Load.

when i would delete an item in the datagrid, the page would post back,
and Page_Load would fire, but the datagrid_itemcommand event would not
fire. the datagrid would disappear from the page.

i tried adding in a PreRender event for the usercontrol, and calling
BindGrid() there, and that kept the datagrid on screen after postbacks,
but the itemcommand event still didn't fire. what got it working was i
removed the if(!IsPostBack) from the Page_Load of the user control, so
then the datagrid is bound every time. i then had the problem of the
itemcommand event being called twice (what a surprise). the reason is
because it was set in the aspx page, as Steven suggested:
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...>
but it was also set in InitialiseComponent in code. i took it out of
the code, and let the aspx handler do it.

now it works perfectly. i didn't run into any problems re-binding the
datagrid in Page_Load, my methods were still able to identify the row
that was clicked and any of the controls in the cells.

thanks for your help.
tim

strange event postback behaviour in dynamically created usercontrol

hi,
i have an aspx page which dynamically loads a user control and adds it
to a placeholder. the control is recreated and added to the
placeholder for postbacks as well.
the user control contains a datagrid and some buttons and textboxes.
the button events fire correctly and execute their code. however, the
datagrid events fire a postback, and execute Page_load in the
usercontrol, but the Item_Command code is not executed. the code to
add events to the datagrid is in InitialiseComponent.
i have the datagrid binding in UserControl_PreRender, so that it is
bound between postbacks.
can anyone suggest why the postback is happening without the
ItemCommand event happening? i've verified this with VS debugging.
thanks
timHi Tim_Mac,
Welcome to ASP.NET newsgroup.
From your description, you've a UserControl which contains some button and
a DataGrid on it, the datagrid is subscribing some postback
events(ItemCommand). And in one of your asp.net page, you dynamically load
the usercontrol and add it on your page. However, you found the ItemCommand
of the datagrid(in usercontrol) always not fire, yes?
Based on my experience, such event handler not executing problem is likely
caused by the following things:
1. For dynamic loaded(created) controls, make sure we add them in the
Page_Init or Page_Load every time the page is requested(IsPostback or
not...).
2. For control's event handler, we also need to register them in Init or
Load event. Also, for template databound controls such as DataGrid or
DataList, we should avoid rebinding them with different datasource before
processing postback event since the event may depend on the original binded
datas.
As for your condition, since some other controls (such as button)'s event
handler execute correctly. I think the problem is likely within the
UserControl itself. Would you try registering your datagrid's ItemCommand
handler in the usercontrol's ascx template instead of programmatically
register in codebehind? Just like
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...>
If you feel it convenient, I suggest you try build a simpler usercontrol
(contains a datagrid) so as to repro the problem and send it to me. Then I
can do some researchs on my side.
In addition, if you feel necessary, I can also generate a test page on my
side and let you have a compare to see whehter there are any difference.
Please feel free to let me know if you have any questions. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
hi Steven,
thank you for your most helpful reply.
i have got it working now, and will attempt to explain how and why for
future reference.
my aspx page contaings the following in Page_Load:
Modules.SportsLadder ladder =
this.LoadControl("Modules/SportsLadder.ascx") as Modules.SportsLadder;
this.serverForm.Controls.Add(ladder);
the user control is loaded regardless of whether a postback has taken
place or not.
the user control then contains a call to if(!IsPostBack) BindGrid() in
the Page_Load.
when i would delete an item in the datagrid, the page would post back,
and Page_Load would fire, but the datagrid_itemcommand event would not
fire. the datagrid would disappear from the page.
i tried adding in a PreRender event for the usercontrol, and calling
BindGrid() there, and that kept the datagrid on screen after postbacks,
but the itemcommand event still didn't fire. what got it working was i
removed the if(!IsPostBack) from the Page_Load of the user control, so
then the datagrid is bound every time. i then had the problem of the
itemcommand event being called twice (what a surprise). the reason is
because it was set in the aspx page, as Steven suggested:
<asp:datagrid ..... OnItemCommand="DataGrid_ItemCommand" ...>
but it was also set in InitialiseComponent in code. i took it out of
the code, and let the aspx handler do it.
now it works perfectly. i didn't run into any problems re-binding the
datagrid in Page_Load, my methods were still able to identify the row
that was clicked and any of the controls in the cells.
thanks for your help.
tim
Hi Tim_Mac,
Thanks a lot for your detailed response. I'm glat that you've got greate
progress on this issue. Though you've got it worked currently, I'm still
abit confusing about your detailed page and usercontrol's code logic. Based
on my understanding, as long as your UserControl is added into the page's
control collection everytime( and has a fixed it assigned to it). We don't
need to bind data to the datagrid(in the usercontrol) everytime, just in
If(! IsPostback) ) or in a postback event is ok. And the ItemCommand can
also fire correctly.
I've attached a sample page/usercontrol I used to test. You can have a test
on your side if you have interesting.
Hope helps. If there is anything else unclear, please feel free to post
here. Thanks,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Thursday, March 22, 2012

Strange IIS6.0/ASP.NET Behaviour (HELP!)

I have a web app that builds a tree from a database. The tree is built on
demand when the user POSTs the page back to the sever. The server maintains
a copy of the current tree in a session object.
This all works fine on the development server but I have a problem on my
live server (IIS6.0 ASP.NET 1.1). When the user posts the page back the
request is not getting to ASP.NET. When tracing is enabled there is no
entry. However the browser is getting an old picture of the tree from a
couple of clicks ago and things start going a bit haywire.
I have set every option I can find within my code to prevent caching
occuring, and I know that no servers along the route a caching because I get
the same problem when I access the app from the server using localhost.
I have read a bit about 2003 and the http.sys cache and believe that my
problem my lie here.
HELP!!
Thanks in anticipation
Mikere:
> I have read a bit about 2003 and the http.sys cache and believe that my
> problem my lie here.
There is a simple way to find out if the problem is with the http.sys cache.
You can disable it entirely.
That way, if the problem continues, you'll know it's not http.sys's fault.
Follow the instructions at http://support.microsoft.com/?id=820129
to create a DWORD value of zero for "UriEnableCache" at this key :
HKEY_LOCAL_MACHINE\System\CurrentControl
Set\Services\HTTP\Parameters
Mind you, use this only for test purposes.
The http.sys cache is important for IIS's performance.
Here's some more background info on http.sys cache which you will find
interesting, since it details the reasons for http.sys *not* caching content
:
http://support.microsoft.com/Default.aspx?id=817445
You might want to try out any of those techniques
to force http.sys to not cache content.
Juan T. Llibre
ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
==========================
"Mike Trebilcock" <no@.replies.here> wrote in message
news:dgb3gc$atl$1@.news8.svr.pol.co.uk...
>I have a web app that builds a tree from a database. The tree is built on
> demand when the user POSTs the page back to the sever. The server maintai
ns
> a copy of the current tree in a session object.
> This all works fine on the development server but I have a problem on my
> live server (IIS6.0 ASP.NET 1.1). When the user posts the page back the
> request is not getting to ASP.NET. When tracing is enabled there is no
> entry. However the browser is getting an old picture of the tree from a
> couple of clicks ago and things start going a bit haywire.
> I have set every option I can find within my code to prevent caching
> occuring, and I know that no servers along the route a caching because I g
et
> the same problem when I access the app from the server using localhost.
> I have read a bit about 2003 and the http.sys cache and believe that my
> problem my lie here.
> HELP!!
> Thanks in anticipation
> Mike
>
>