Showing posts with label session. Show all posts
Showing posts with label session. Show all posts

Thursday, March 29, 2012

Passing Values

I know that I can create session variables and pass those values from one
screen to another, but is there not a way to makes variables from one scree
n available to another screen other then session variables? Is there not a
way to create properties in the one screen and then pass some sort of
reference to the screen you are calling?

Can you point me to an example or an article on how to use?

Thanks in advance for your assistance!!!!!!!!Passing Values from Aspx to Aspx

Although ASP.NET usually submits data to the current page for processing,
there are times when you need to pass values from the controls on one page
to controls or routines on another ASP.NET page.
This is a cookbook style tutorial that shows you how to pass from one page
to another. For a deeper explanation, see the Microsoft Help file references
at the bottom of the page.

http://authors.aspalliance.com/kenc/passval.aspx

"Jim Heavey" <JimHeavey@.nospam.com> wrote in message
news:Xns948861B2BA553JimHeaveyhotmailcom@.207.46.24 8.16...
>I know that I can create session variables and pass those values from one
> screen to another, but is there not a way to makes variables from one
> scree
> n available to another screen other then session variables? Is there not
> a
> way to create properties in the one screen and then pass some sort of
> reference to the screen you are calling?
> Can you point me to an example or an article on how to use?
> Thanks in advance for your assistance!!!!!!!!
someone asked exactly the same questions like 10 posts before you so check there

passing values from a web page into windows form application

Hi guys,

How can I pass session/application values from a web page (ASP or
ASP.NET) that is on a host company, into my cliente application?

So I can hide menus based on access permisions once the user makes the
log in in the web page by the application.

I'm using VB.NET with Web Control COM

Thank you

Bruno Alexandre
(Sintra, PORTUGAL)Hi Bruno,

You could post the values to a page from your site containing a vb6
component. The vb6 component would run in-process and with a reference to
the 'Microsoft Active Server Pages Object Library' you could then query the
session and application variables ASPTypeLibrary.Session and
ASPTypeLibrary.Application.
I have a sample program which isfreely available from a demonstration I did
on this a while back available at
http://www.crainiate.net/downloads/vb6wsdemo.zip

This component would then need to notify your application across process's,
there are a number of ways of doing this.

Your client would however need to run IIS, so this solution is limited to
windows2000 or windowsXP.

Kind regards,
James

--
Create interactive flowcharts, diagrams and UML models with ERM3 at
http://www.crainiate.net

"Bruno Alexandre" <bruno.alexandre@.filtrarte.com> wrote in message
news:uWoY6OsoDHA.2188@.TK2MSFTNGP11.phx.gbl...
> Hi guys,
> How can I pass session/application values from a web page (ASP or
> ASP.NET) that is on a host company, into my cliente application?
> So I can hide menus based on access permisions once the user makes the
> log in in the web page by the application.
> I'm using VB.NET with Web Control COM
>
> Thank you
> Bruno Alexandre
> (Sintra, PORTUGAL)

Passing values from labels to text boxes via session variables

I'm passing label values from one page to text boxes in another page for user update. I'm using session variables, but I have been unable to display the passed values in the receiving text boxes. I'm not sure if the syntax is wrong or if the constructs are inappropriate. I'm new and need help.

<code>
SENDING PAGE:

<%@dotnet.itags.org. Page Language="vb" %>
<script runat="server"
Sub doSubmit(Source as Object, E as EventArgs)
Context.Items.Add("first", txtFirst.text)
Context.Items.Add("last", txtLast.text)
Server.Transfer("3.aspx")
End Sub

</script>
<html
<head>
<title>1.aspx</title>
</head
<body
<form id="form1" runat="server">
First Name: <asp:TextBox id="txtFirst" runat="server" /><br>
Last Name: <asp:TextBox id="txtLast" runat="server" />
<asp:Button id="button1" Text="Submit" onclick="doSubmit" runat="server" />
</Form>
</body>
</html
RECEIVING PAGE:

<%@dotnet.itags.org. Page Language="vb" %>
<script runat="server"
Sub Page_Load(Source as Object, E as EventArgs)

label1.text = "The Name you entered was : " & Context.Items("first") & " " & _
Context.Items("last")
textbox1.text = Context.Items("First")
textbox2.text = Context.Items("Last")

End Sub

</script>
<html>
<head>
<title>Second Page</title>
<asp:Label ID="label1" runat="server" />
</head>
<body>
<form name="Form1" runat="server">
<asp:TextBox id="textBox1" Text='<%# "textbox1" %>' runat="server"></asp:TextBox>
<asp:TextBox id="textBox2" Text='<%# "textbox2" %>' runat="server"></asp:TextBox>
</form>
</body>
</htmlIn the recieving pae's load event you're setting the value of the textbox so you don't need to bind the text box's value to itself (so just leave out the "Text=' etc." attribute).

Also, the items collection is case sensitive. You're adding items as "first" and "last" but you're trying to retrieve values from "First" and "Last". Choose a case and stick with it and the problem is resolved.
you made my day Chapel21. thanx for the prompt response and the explanation given, it makes a bit clearer what each line of code does.

sometimes I think I should've studied CGI scripting 5 years ago, when i had time to invest. by now, ASP .NET should've been simpler to understand and use, or may be not.. thanx again,

Monday, March 26, 2012

Passing Values from one page to another

I am passing ID of login user as Session variable and i hv to pass id of one more item and that i m passing in query string.But this is not safe, so how can i encrypt and decrypt that id so if user make some changes in id in addressbar of explorer, it didn't get the data.You can use this link to encrypt the data before putting it in a session variable, then decrypt the data again when you want to read it:

Encryption/Decryption with .NET

regards
But i m not using session variable in 2nd case. Ihv to pass the 2nd id in query string. But i want encryption and decruption for that or is that possible that quesry string not visile to end user.

Saturday, March 24, 2012

Passing variables between pages

What is the best method to pass variables between pages?
Is it through the Session object with large quantities of data and with the querystring/params with smaller quantities?

Hi smith,

Please have a look at this article.

http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/

For a quick reference,

http://msdn.microsoft.com/msdnmag/issues/03/04/ASPNETUserState/default.aspx?fig=true#fig1

HTH.


Yes, that is correct.

and for example when I assign a dataset to a Sessionobject as so:

Session("MyData")=MyDataSet
How can I retreive the data from this in another page? Do I need to create a new dataset object and assign the stored dataset to it, like so:
DataSetInOtherPage = Session("MyData") ?


Peter Smith wrote:

and for example when I assign a dataset to a Sessionobject as so:

Session("MyData")=MyDataSet
How can I retreive the data from this in another page? Do I need to create a new dataset object and assign the stored dataset to it, like so:
DataSetInOtherPage = Session("MyData") ?

Session stores its values as Objects, which means that it can store anything, as everything derives from Object. This means that you must cast the Session item when assigning it to a local variable. For example:

DataSet DataSetInOtherPage = Session["MyData"] as DataSet; [C#]

Dim DataSetInOtherPage As DataSet = CType(Session("MyData"), DataSet) [VB.NET]

Passing variables between projects?

Hey all,
Is it possible to pass session variables between pages in separate
projects?
For example:
inetpub\thisproject\blah.aspx
has a session variable and response.redirects the user to
inetpub\anotherproject\test.aspx
When I try to access the session variable after the redirection, it
doesn't exist? I'm assuming this is because the two pages have separate
bin files? How can I pass a variable between these two?
Thanks.
*** Sent via Developersdex http://www.examnotes.net ***you can share session , if you can build both projects in to a single
web application
MSDN article explaning "Make Multiple Visual Studio .NET Projects
Participate in the Same Web Application"
http://support.microsoft.com/defaul...;en-us;307467#5
No, session data is not shared between separate applications.
You might look at other ways of passing data between applications, such as a
common database or passing values via post or querystring.
I hope this helps,
Steve C. Orr
MCSD, MVP
http://Steve.Orr.net
"Roy" wrote:

> Hey all,
> Is it possible to pass session variables between pages in separate
> projects?
> For example:
> inetpub\thisproject\blah.aspx
> has a session variable and response.redirects the user to
> inetpub\anotherproject\test.aspx
> When I try to access the session variable after the redirection, it
> doesn't exist? I'm assuming this is because the two pages have separate
> bin files? How can I pass a variable between these two?
> Thanks.
> *** Sent via Developersdex http://www.examnotes.net ***
>

Passing variables between projects?

Hey all,

Is it possible to pass session variables between pages in separate
projects?

For example:
inetpub\thisproject\blah.aspx
has a session variable and response.redirects the user to
inetpub\anotherproject\test.aspx

When I try to access the session variable after the redirection, it
doesn't exist? I'm assuming this is because the two pages have separate
bin files? How can I pass a variable between these two?

Thanks.

*** Sent via Developersdex http://www.developersdex.com ***you can share session , if you can build both projects in to a single
web application

MSDN article explaning "Make Multiple Visual Studio .NET Projects
Participate in the Same Web Application"

http://support.microsoft.com/defaul...;en-us;307467#5
No, session data is not shared between separate applications.
You might look at other ways of passing data between applications, such as a
common database or passing values via post or querystring.

--
I hope this helps,
Steve C. Orr
MCSD, MVP
http://Steve.Orr.net

"Roy" wrote:

> Hey all,
> Is it possible to pass session variables between pages in separate
> projects?
> For example:
> inetpub\thisproject\blah.aspx
> has a session variable and response.redirects the user to
> inetpub\anotherproject\test.aspx
> When I try to access the session variable after the redirection, it
> doesn't exist? I'm assuming this is because the two pages have separate
> bin files? How can I pass a variable between these two?
> Thanks.
> *** Sent via Developersdex http://www.developersdex.com ***

passing variables from one page to another

is there any other way of passing variables on one page to another with out using a session state or cookies or querystring

I have two pages page a and page b
they both have a button that is labeled create new entry only the sub to create the new entry is on page a and not on page b and the button on page b simply links to page a where they have to press the create new entry button again is their any way around this?This may help:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtskpassingvaluesbetweenwebformspages.asp

Simon

Wednesday, March 21, 2012

Passing variables to SSL page?

What is the best way to send a variable (or two or three) to an SSL page? My app used session variables, but that doesn't work (new session, I suppose). I figured that I would just place the variables into a cookie, but that seemed to not work either, though I can't come up with a reason why not (except programmer error). I have been reduced to using the query string, but is there a better way? Have I given up on my cookie idea too quickly? The page that is protected by SSL is in the same folder as the page that is redirecting to it, if that is important.

Seethis article about Session State in ASP.NET, in the MSDN library. Near the very end of the article is explains about ApplyAppPathModifier, which essentially inserts the SessionID in the URL.
The funny things is that I have used Session between HTTP and HTTPS, in the past, without any problems.

Passing variables vs session variable

what is the advantage of passing the variable in the url vs storing the variable in a session variable and retrieving it in the second webpage you are accessing?

The variable that you will pass using the QueryString will be visible to the user hence not secured. The value that you put in the Session is not available to the user as it is on the server side and hence more secured.


performance wise does it matter?


Just my 2 cents...

I remember in college the professors would always harp upon using the Session responsibly. Most of the professors were older and came from backgrounds where memory was used sparingly. So, if you were cramming loads of data into the Session (back in the day), you'd maybe begin to experience some bad effects because of it. Accordingly it was advised to use the Session sparingly.

However, it seems to me that things have changed a little. We have more memory and it's faster than ever; the average joe-blow user has more bandwidth than ever. Consequently I don't think people worry about using the Session too much as much.


Yes, performance wise, session variables take up memory on the server so using too many sessions can affect the overall performance of the site. I use them a lot and haven't seen too much of a performance issue, you must have to use a lot of them to affect memory. Or maybe sticking arrays into sessions would start to affect things. Good luck, Mike


there are a few ways of passing variables around:

Single page Postbacks:

1) Use ViewState. It's simple, encrypted. Only problem is too much will slow the clients computer down

2) Use hidden <asp:labels />. Pretty much the same approach as the veiw state.


Navigating from page-> page

1) Query String. Yea, they might see some ID's at the top.

2) you can "Submit" to a new page with ASP.NET 2.0, which allows you to use values from your original page.

3) You can use session. But I would advise against it. Session variables should be used to house things that are important for the user, like: ID, UserName, etc. I would never want to see a dataTable, Array, etc. stored in the session.


Passport Redirection Problem.

Hi. all!!!!!!!!

With Passport Authentication
AFTER SESSION TIME OUT How can i redirect the user to the Passport
login page.

And after getting the credential. I need to again redirect to the same
page..

I used the below code in vb.net

identity.LoginUser(redirectURL, 60, 1, Nothing, -1, Nothing, -1, 0,
Nothing)

but it is popping a window for username and password.

Without Popups. I need to redirect the user to the
Standard Passport Login page..

BUT
After deploying on the server i am not even getting the Pop up. and it
is giving the standard Passport error..

"The .NET Passport service is currently unavailable at this Web site
for one of these reasons:
The site may contain an error or be experiencing a problem that
affects the .NET Passport service.
The .NET Passport service may be experiencing a temporary problem.
The site may not be an official .NET Passport-participating site.

Please return to this site later to try again.
"

Please help me out to Over come this Problem

Thanx in AdvanceCheck out this article on how to implement passport authentication in your
web page,
http://www.extremeexperts.com/Net/A...ssportAuth.aspx

--
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com

"Munna" <kkknnn321@.yahoo.com> wrote in message
news:b52ff2e2.0407100433.647104b3@.posting.google.c om...
> Hi. all!!!!!!!!
> With Passport Authentication
> AFTER SESSION TIME OUT How can i redirect the user to the Passport
> login page.
> And after getting the credential. I need to again redirect to the same
> page..
> I used the below code in vb.net
> identity.LoginUser(redirectURL, 60, 1, Nothing, -1, Nothing, -1, 0,
> Nothing)
> but it is popping a window for username and password.
> Without Popups. I need to redirect the user to the
> Standard Passport Login page..
> BUT
> After deploying on the server i am not even getting the Pop up. and it
> is giving the standard Passport error..
> "The .NET Passport service is currently unavailable at this Web site
> for one of these reasons:
> The site may contain an error or be experiencing a problem that
> affects the .NET Passport service.
> The .NET Passport service may be experiencing a temporary problem.
> The site may not be an official .NET Passport-participating site.
>
> Please return to this site later to try again.
> "
> Please help me out to Over come this Problem
> Thanx in Advance
I am also facing the similar problem.
Any solution is most welcome.

"Munna" wrote:

> Hi. all!!!!!!!!
> With Passport Authentication
> AFTER SESSION TIME OUT How can i redirect the user to the Passport
> login page.
> And after getting the credential. I need to again redirect to the same
> page..
> I used the below code in vb.net
> identity.LoginUser(redirectURL, 60, 1, Nothing, -1, Nothing, -1, 0,
> Nothing)
> but it is popping a window for username and password.
> Without Popups. I need to redirect the user to the
> Standard Passport Login page..
> BUT
> After deploying on the server i am not even getting the Pop up. and it
> is giving the standard Passport error..
> "The .NET Passport service is currently unavailable at this Web site
> for one of these reasons:
> The site may contain an error or be experiencing a problem that
> affects the .NET Passport service.
> The .NET Passport service may be experiencing a temporary problem.
> The site may not be an official .NET Passport-participating site.
>
> Please return to this site later to try again.
> "
> Please help me out to Over come this Problem
> Thanx in Advance

Passport Redirection Problem.

Hi. all!!!!!!!!
With Passport Authentication
AFTER SESSION TIME OUT How can i redirect the user to the Passport
login page.
And after getting the credential. I need to again redirect to the same
page..
I used the below code in vb.net
identity.LoginUser(redirectURL, 60, 1, Nothing, -1, Nothing, -1, 0,
Nothing)
but it is popping a window for username and password.
Without Popups. I need to redirect the user to the
Standard Passport Login page..
BUT
After deploying on the server i am not even getting the Pop up. and it
is giving the standard Passport error..
"The .NET Passport service is currently unavailable at this Web site
for one of these reasons:
The site may contain an error or be experiencing a problem that
affects the .NET Passport service.
The .NET Passport service may be experiencing a temporary problem.
The site may not be an official .NET Passport-participating site.
Please return to this site later to try again.
"
Please help me out to Over come this Problem
Thanx in AdvanceCheck out this article on how to implement passport authentication in your
web page,
http://www.extremeexperts.com/Net/A...ssportAuth.aspx
Saravana
Microsoft MVP - ASP.NET
www.extremeexperts.com
"Munna" <kkknnn321@.yahoo.com> wrote in message
news:b52ff2e2.0407100433.647104b3@.posting.google.com...
> Hi. all!!!!!!!!
> With Passport Authentication
> AFTER SESSION TIME OUT How can i redirect the user to the Passport
> login page.
> And after getting the credential. I need to again redirect to the same
> page..
> I used the below code in vb.net
> identity.LoginUser(redirectURL, 60, 1, Nothing, -1, Nothing, -1, 0,
> Nothing)
> but it is popping a window for username and password.
> Without Popups. I need to redirect the user to the
> Standard Passport Login page..
> BUT
> After deploying on the server i am not even getting the Pop up. and it
> is giving the standard Passport error..
> "The .NET Passport service is currently unavailable at this Web site
> for one of these reasons:
> The site may contain an error or be experiencing a problem that
> affects the .NET Passport service.
> The .NET Passport service may be experiencing a temporary problem.
> The site may not be an official .NET Passport-participating site.
>
> Please return to this site later to try again.
> "
> Please help me out to Over come this Problem
> Thanx in Advance
I am also facing the similar problem.
Any solution is most welcome.
"Munna" wrote:

> Hi. all!!!!!!!!
> With Passport Authentication
> AFTER SESSION TIME OUT How can i redirect the user to the Passport
> login page.
> And after getting the credential. I need to again redirect to the same
> page..
> I used the below code in vb.net
> identity.LoginUser(redirectURL, 60, 1, Nothing, -1, Nothing, -1, 0,
> Nothing)
> but it is popping a window for username and password.
> Without Popups. I need to redirect the user to the
> Standard Passport Login page..
> BUT
> After deploying on the server i am not even getting the Pop up. and it
> is giving the standard Passport error..
> "The .NET Passport service is currently unavailable at this Web site
> for one of these reasons:
> The site may contain an error or be experiencing a problem that
> affects the .NET Passport service.
> The .NET Passport service may be experiencing a temporary problem.
> The site may not be an official .NET Passport-participating site.
>
> Please return to this site later to try again.
> "
> Please help me out to Over come this Problem
> Thanx in Advance
>

Friday, March 16, 2012

Password Field and Session Vars

Hey, I'm not sure what happened, but I ran into a simple problem I can't figure out.

All I'm trying to do is read two text boxes, txtUserEmail and txtUserPassword. I then take the txtUserEmail value and pass it into a stored proc, which matches it against an Email address in the MSDE. The stored proc returns the UserEmail, UserPassword, UserGroup (role) and UserEmailConfirm.

All I wanted to do is check txtUserEmail.text and txtUserPassword vs the UserEmail and UserPassword fields in my table that I'm getting back from the stored proc. Based on a match, I want to set a couple of Session vars.

fnReturnDataSet is in another module. It takes the stored proc call and returns the data set with the appropriate information.

The problem is that the Sub is skipping over the FOR loop and I'm not sure why. I know I'm only returning one row, but it's easy to just use this temeplate to get the dataset since it's working on 4 other pages I wrote.

If anyone could give me a hint what's wrong, I'd appriciate it.

--------------

Protected Sub btnUserLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUserLogin.Click
Dim strUserEmail, strUserPassword As String
Dim objSQL As String
Dim dsUserInfo As DataSet
Dim row As DataRow

strUserEmail = txtUserEmail.Text
strUserPassword = txtUserPassword.Text

objSQL = "EXECUTE spValidateUser '" & strUserEmail & "'"
dsUserInfo = fnReturnDataSet(objSQL)

For Each row In dsUserInfo.Tables("dtReturnedTable").Rows
If (row("UserEmail") = strUserEmail) And (row("UserPassword") = strUserPassword) And (row("UserEmailConfirm") = "yes") Then
Session("User") = row("UserEmail")
Session("UserGroup") = row("UserGroup")
lblConfirm.Text = "You are now logged in"
Else
lblError.Text = "The username or password provided are not valid"
End If
Next
End Subhello, have u tried to add
row("UserEmail").ToString() = strUserEmail ...

try it.
I actually figured everything out, but thank you for the suggestion.

I also found an article with some encryption classes to use:
http://www.15seconds.com/issue/021210.htm

I have the cookie encrypted as far as I can tell. I set one key to the UserName and a second to a UserRole. I just need to encrypt the passwords in my SQL database and I should be all set.

Eric