Dear all,
Sorry for cross posting.
I have one page, create an object and save it in session scope, and then redirect to another page.In the new page, the object existed in session object, but can not access its property. The code of page one is :
<%
Class SiteInfo
dim SiteID, SiteName
end class
dim site
set site = new SiteInfo
site.SiteID = "01"
site.SiteName = "Microsoft"
set session("formda ta") = site
response.redire ct "edit.asp"
%>
the code in edit.asp:
<%
if isObject(sessio n("formdata") then
response.write session("formda ta").SiteID
end if
%>
the error occured at line "response.write " :
object can not support the property or method: SiteID
Could you please help me to check why this happen?
Appreciate for any advice.
Best Regards
lichunlin
China 8 1473
> I have one page, create an object and save it in session scope,
WHY DOES THIS HAVE TO BE AN OBJECT?????
Just use an array, it will make your life much simpler.
Dear Aaron,
Thanks for your response.
I would like to create it as an object, because I think the object would be more encapsulated when I use the object more and more times.
Thanks & regards
lichunlin
"Aaron [SQL Server MVP]" wrote: I have one page, create an object and save it in session scope,
WHY DOES THIS HAVE TO BE AN OBJECT?????
Just use an array, it will make your life much simpler.
Does it work when in the same page ?
I would try also to get the object from the session before using it (I
suspect a confusion between the objet that is returned by the session
collection and the object that is stored at this position).
Patrice
--
"Lichunlin" <Li*******@disc ussions.microso ft.com> a écrit dans le message de
news:FE******** *************** ***********@mic rosoft.com... Dear all,
Sorry for cross posting.
I have one page, create an object and save it in session scope, and then
redirect to another page.In the new page, the object existed in session
object, but can not access its property. The code of page one is : <% Class SiteInfo dim SiteID, SiteName end class
dim site set site = new SiteInfo site.SiteID = "01" site.SiteName = "Microsoft" set session("formda ta") = site
response.redire ct "edit.asp" %>
the code in edit.asp: <% if isObject(sessio n("formdata") then response.write session("formda ta").SiteID end if %>
the error occured at line "response.write " : object can not support the property or method: SiteID
Could you please help me to check why this happen? Appreciate for any advice. Best Regards lichunlin China
> I would like to create it as an object, because I think the object would
be more encapsulated when I use the object more and more times.
So, it is more important that it is "more encapsulated", or that it
functions???
Also, are you aware of the dangers of placing (even simple) objects in the
session/application scope? http://www.aspfaq.com/2053
-- http://www.aspfaq.com/
(Reverse address to reply.)
Lichunlin <Li*******@disc ussions.microso ft.com> wrote in message news:<FE******* *************** ************@mi crosoft.com>... Dear all,
Sorry for cross posting.
I have one page, create an object and save it in session scope, and then redirect to another page.In the new page, the object existed in session object, but can not access its property. The code of page one is : <% Class SiteInfo dim SiteID, SiteName end class
dim site set site = new SiteInfo site.SiteID = "01" site.SiteName = "Microsoft" set session("formda ta") = site
response.redire ct "edit.asp" %>
the code in edit.asp: <% if isObject(sessio n("formdata") then response.write session("formda ta").SiteID end if %>
the error occured at line "response.write " : object can not support the property or method: SiteID
Did you copy and paste this code? If so, you're missing a ) at the following line
if isObject(sessio n("formdata") then
Patrice,
Thanks a lot, It can work in the same page, just can not when redirect to another page.
I store the object in session scope just because I want to transfer the object into another page. If you have other more useful way to do so, please let me know, thanks.
Best regards
lichunlin
"Patrice" wrote: Does it work when in the same page ?
I would try also to get the object from the session before using it (I suspect a confusion between the objet that is returned by the session collection and the object that is stored at this position).
Patrice
--
"Lichunlin" <Li*******@disc ussions.microso ft.com> a écrit dans le message de news:FE******** *************** ***********@mic rosoft.com... Dear all,
Sorry for cross posting.
I have one page, create an object and save it in session scope, and then redirect to another page.In the new page, the object existed in session object, but can not access its property. The code of page one is : <% Class SiteInfo dim SiteID, SiteName end class
dim site set site = new SiteInfo site.SiteID = "01" site.SiteName = "Microsoft" set session("formda ta") = site
response.redire ct "edit.asp" %>
the code in edit.asp: <% if isObject(sessio n("formdata") then response.write session("formda ta").SiteID end if %>
the error occured at line "response.write " : object can not support the property or method: SiteID
Could you please help me to check why this happen? Appreciate for any advice. Best Regards lichunlin China
Dear Aaron,
I just want to class to encapsulate all properties, I feel it useful.And I store the object into session scope just because I want to transfer into other asp page, the new page can access the object. If you have other useful way to do so, please feel free to let me know. Thanks a lot.
Best Regards
lichunlin
"Aaron [SQL Server MVP]" wrote: I would like to create it as an object, because I think the object would be more encapsulated when I use the object more and more times.
So, it is more important that it is "more encapsulated", or that it functions???
Also, are you aware of the dangers of placing (even simple) objects in the session/application scope? http://www.aspfaq.com/2053
-- http://www.aspfaq.com/ (Reverse address to reply.)
A bit hard without the whole picture. Generally data are listed and a A href
link allows to go on the edit page with the id on the querystring. The whole
data are then retrieved from the db for editing (genrally the list has
anyway a subset of all the fields).
As a side note, you can also have an object stores its properties using the
session object instead of storing the object itself...
Patrice
--
"Lichunlin" <Li*******@disc ussions.microso ft.com> a écrit dans le message de
news:3C******** *************** ***********@mic rosoft.com... Patrice,
Thanks a lot, It can work in the same page, just can not when redirect to
another page. I store the object in session scope just because I want to transfer the
object into another page. If you have other more useful way to do so, please
let me know, thanks. Best regards lichunlin
"Patrice" wrote:
Does it work when in the same page ?
I would try also to get the object from the session before using it (I suspect a confusion between the objet that is returned by the session collection and the object that is stored at this position).
Patrice
--
"Lichunlin" <Li*******@disc ussions.microso ft.com> a écrit dans le
message de news:FE******** *************** ***********@mic rosoft.com... Dear all,
Sorry for cross posting.
I have one page, create an object and save it in session scope, and
then redirect to another page.In the new page, the object existed in session object, but can not access its property. The code of page one is : <% Class SiteInfo dim SiteID, SiteName end class
dim site set site = new SiteInfo site.SiteID = "01" site.SiteName = "Microsoft" set session("formda ta") = site
response.redire ct "edit.asp" %>
the code in edit.asp: <% if isObject(sessio n("formdata") then response.write session("formda ta").SiteID end if %>
the error occured at line "response.write " : object can not support the property or method: SiteID
Could you please help me to check why this happen? Appreciate for any advice. Best Regards lichunlin China This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Michael J. Astrauskas |
last post by:
I have a site where a user logs in and a session variable I created
is used to keep track of the fact that the user is logged in. This
various pages query a MySQL database to get information (mostly to
generate a catalogue and news page). Occasionally when loading a page I
simply get the error "No database selected" when the PHP script attempts
to run the query. Usually I can press reload in my browser (Netscape,
IE, and Opera) and the...
|
by: EP |
last post by:
Hello,
Could someone tell me what this error is trying to
indicate. I do not get a line number or reference
indicating where the error is occuring.
Thanks in advance.
|
by: Paul Tomlinson |
last post by:
I am trying to call a delegate on my parent from a child thread, this is my
code, however i'm getting an exception "Object type cannot be converted to
target type." which I can't understand. The prototype for my delegate is:
public delegate void ExceptionDelegate( object o ); // called from all
child threads
This is the offending code. Can anyone shed any light please?
if( myParent.InvokeRequired )
|
by: Dica |
last post by:
i'm getting an error when trying set my dataAdapter's selectCommand. the
sqlStatement is a storedProc which takes parameters, so it's constructed as:
sqlSelectCommand1.CommandText = "";
sqlSelectCommand1.CommandType = System.Data.CommandType.StoredProcedure;
sqlSelectCommand1.Connection = sqlConnection1;
sqlSelectCommand1.Parameters.Add(new
|
by: Abhilash.k.m |
last post by:
This is regarding the session management using Out of
proc session management(SQL SERVER). Among the samples
below which one is better to set the session?
1. There are 20 session variables and all of them
are being stored into session and accessed from session
and individual session object. Example: Session
= "XYZ", Session=100, Session="NAME", etc.
| |
by: Kim Bach Petersen |
last post by:
I would like to record user behavior data stored in session variables.
Since the data is modified throughout each session it seemed obvious to
store the data when the session terminates - using Session_End in
global.asax.
Problem is, apparently the session-object terminating cannot be accessed
from Session_End in global.asax!?
What's the meaning of Session_End if you don't know which session is
|
by: John Mullin |
last post by:
We are having a problem which appears similar to a previous posting:
http://groups.google.com/groups?hl=en&lr=&frame=right&th=d97f552e10f8c94c&seekm=OZw33z9EDHA.2312%40TK2MSFTNGP10.phx.gbl#link1
In the current release of our system, we decided to "wrap" the ASP.NET
Session and Application objects to improve code clarity and accuracy.
For example, instead of:
Session = new SomeListClass;
|
by: Barry |
last post by:
object type cannot be converted to target type - i am getting this error message occuring numerous times in my task list, my project compiles and runs ok but it is a nuisance, I think Ihva eheard of this before but I cannot remember the solution, anybody got any help?
|
by: news.microsoft.com |
last post by:
I got this error "Object type cannot be converted to target type" in my VB
Winforms application. When I click on it, it goes no where, how do I
troubleshoot this? Thank you.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |