Showing posts with label parts. Show all posts
Showing posts with label parts. Show all posts

Thursday, March 29, 2012

Separate vb page?

Question, in two parts, I have separated my vb code from the asp page. But, I have noticed on many code samples this is not 'normally' being done. I have also noticed that it is easier to reference controls if you write your scripts on an asp page. If you separate your vb code from an asp page what is the best way to reference your controls and their properties? Also, What is considered 'best practice'? Should you separate them or not?

Thanks in advanceMarvin

As far as using code behind, I don't think that it is a best practice but a personal choice. I personally like the code behind because it keeps all my code in one place and easier for me to referrance. When I need to add an even or sub, I just double click on either the object or page depending on what I want to do.

OK... what you want to be doing is usingCodeBehind. You can select this as an option when you create your page.

Whether you use codebehind or have it on the page will makeno difference with regards to accessing your controls and their properties.

Many samples don't use code behind because it ismuch easier to post a sample that novice users can just paste into a page when you include the server-side script in the page.


Thank you both for your replies.

James, forgive me I am still new to all of this asp.net. When you say 'codebehind' do you mean... separating the vb from the ASP page? I am assuming this is correct. right?


Codebehind separates the markup (asp to you) and the source code (vb/c#) but maintains a link between them.

See this...http://support.microsoft.com/kb/303247

Thursday, March 22, 2012

Serious issue: parts of my page render as not logged in, parts as logged in. Help!

I'm having a very difficult time with some of our new pages. We've
moved to a web farm, and it seems in spurts it will come where parts
of my page think the user is logged in, and parts think the user is
not logged in. It seems to happen to an entire control. (None of the
controls have OutputCache set)

For example, our login control on top will appear showing the user is
logged inw hen they have been redirected to RegNewUser, but RegNewUser
will display instead of redirecting as if the user were actually
logged in.

The MachineKey option in the web.config is set to a generated SHA1, so
the viewstate moves between the web servers just fine.

This seems to come in spurts where it will happen to a lot of users at
once, then it will stop coming. This is a serious problem on a
production website, I just don't know where to turn or how to debug --
everything looks fine!

I am also getting Forms Authentication failed events in my log:

Event code: 4005
Event message: Forms authentication failed for the request. Reason:
The ticket supplied has expired.
Event time: 4/11/2007 12:42:27 PM
Event time (UTC): 4/11/2007 7:42:27 PM
Event ID: 0a0a593d17984b41aa13b93254491326
Event sequence: 1161
Event occurrence: 13
Event detail code: 50202

Application information:
Application domain: /LM/W3SVC/1/Root-2-128207889508981002
Trust level: Full
Application Virtual Path: /
Application Path: E:\htdocs\mysite-pri\
Machine name: WEB1

Process information:
Process ID: 400
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE

Request information:
Request URL: http://www.mysite.com:8080/default.aspx
Request path: /default.aspx
User host address: 10.10.1.1
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE

Name to authenticate:

Custom event details:Make sure the cookie path is the same on all machines. Make sure that the Web
Site number (e.g., /LM/W3SVC/1/Root-2-128207889508981002 - the "/1/" after
W3SVC) is the same.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net
"pcloches@.gmail.com" wrote:

Quote:

Originally Posted by

I'm having a very difficult time with some of our new pages. We've
moved to a web farm, and it seems in spurts it will come where parts
of my page think the user is logged in, and parts think the user is
not logged in. It seems to happen to an entire control. (None of the
controls have OutputCache set)
>
For example, our login control on top will appear showing the user is
logged inw hen they have been redirected to RegNewUser, but RegNewUser
will display instead of redirecting as if the user were actually
logged in.
>
The MachineKey option in the web.config is set to a generated SHA1, so
the viewstate moves between the web servers just fine.
>
This seems to come in spurts where it will happen to a lot of users at
once, then it will stop coming. This is a serious problem on a
production website, I just don't know where to turn or how to debug --
everything looks fine!
>
I am also getting Forms Authentication failed events in my log:
>
Event code: 4005
Event message: Forms authentication failed for the request. Reason:
The ticket supplied has expired.
Event time: 4/11/2007 12:42:27 PM
Event time (UTC): 4/11/2007 7:42:27 PM
Event ID: 0a0a593d17984b41aa13b93254491326
Event sequence: 1161
Event occurrence: 13
Event detail code: 50202
>
Application information:
Application domain: /LM/W3SVC/1/Root-2-128207889508981002
Trust level: Full
Application Virtual Path: /
Application Path: E:\htdocs\mysite-pri\
Machine name: WEB1
>
Process information:
Process ID: 400
Process name: w3wp.exe
Account name: NT AUTHORITY\NETWORK SERVICE
>
Request information:
Request URL: http://www.mysite.com:8080/default.aspx
Request path: /default.aspx
User host address: 10.10.1.1
User:
Is authenticated: False
Authentication Type:
Thread account name: NT AUTHORITY\NETWORK SERVICE
>
Name to authenticate:
>
Custom event details:
>
>