Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
I am working on a web application in vb.net 2005.
default.aspx is a main page and mailutil.vb is referred from Application code folder in that web application.

I want to pass ID from aspx page to mailutil.vb page in Application code folder. I can't use query string,session,cookies in that page.

Is there any method ?

I want to pass a ID to that function from a .aspx page to mailutil.vb


thanks in advance..

regards,

Sasikumar
Posted
Comments
fjdiewornncalwe 8-Nov-10 9:48am    
Why exactly can't you use the session? It is entirely server based and this is one of the primary reasons it exists?
ramuksasi 8-Nov-10 9:58am    
i think.. u said about global.asax.. that page is working fine.. but additionally am using some external methods in mailutil.vb in app_code folder. i cannot use that sessoin in that page..
jim lahey 8-Nov-10 10:10am    
you use session from anywhere in your web application:

System.Web.HttpContext.Current.Session("MyIDFromPage") = 123
ramuksasi 8-Nov-10 11:23am    
i already tried in this way.. but it gets null values only..

First of all you can use Session, Request, Response, Server, etc.
If I understood you correctly mailutil.vb is a class.

1. Add to this class:
using System.Web;

2. In the method where you want to retrieve say Session["myPassedID"] get the session object:
System.Web.SessionState.HttpSessionState session = HttpContext.Current.Session;

string myID = session["myPassedID"];


Good luck
 
Share this answer
 
v2
can you not just pass it as a parameter from your default.aspx.vb:

Dim someParam as Int
someParam = 123

mailutil.SomeMethod(someParam)


or am I missing something?
 
Share this answer
 
Comments
ramuksasi 8-Nov-10 11:21am    
thanks for ur answer jim.. but this method partially satisfied for me.. bcoz my parameter value could be change every second, i need to pass a fixed value.. i have to show my code.. see below..

dim vid as string = "VSTR" & DateTime.Now.Year & DateTime.Now.DayOfYear & DateTime.Now.Hour & DateTime.Now.Minute & DateTime.Now.Second

vid value could be changed depends upon timing so if i passed into parameter, referring value will be changed everytime.
once it referred that value will never change at any time while passing into mailutil.vb page..

will u help me..


regards

Sasikumar
I could not understand y'r question thoroughly.
Just keep a public static variable in your mailutil.vb's class

Syntax:
Public Shared dim id as String

Then you'll be able to read/write to it without creating an instance as you wish from anywhere
(mailutil.id)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900