Showing posts with label load. Show all posts
Showing posts with label load. Show all posts

Monday, March 26, 2012

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!

Wednesday, March 21, 2012

Please help me

My codebehind file (.aspx.cs) will not load. When I post my web application everything works except the actual code in the .cs file. I mean that when tou press the button it will not execute the code.

If anyone can help me, please do!

Thanks!

the button have runat=server?

Hello,

Is the page being refreshed (postback)?

If yes then go to your code and double click on the button to create the event handler again, then recompile.

If not then tell me to help you sorting that out.

regards


fastlearner wrote:

My codebehind file (.aspx.cs) will not load. When I post my web application everything works except the actual code in the .cs file. I mean that when tou press the button it will not execute the code.

If anyone can help me, please do!

Thanks!

Have you fully compiled your project and deployed the bin directory to your web server?


The page is not beeing refreshed!

The .cs file is probably not beeing loaded at all by the compiler, or second .dll doesn't inherit from the first.

Thanks.


Hello,

1) Try to run your application in different browser (FireFox)

2) execute this C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe -c

regards


Thanks for all your help.

It seems my problem was an improper configuration of the IIS to use ASP.net

Regards


What was the problem? and what you did to solve it?

regards