Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Thursday, March 29, 2012

passing value to another page

hi,

i would like to redirect to customer.aspx from login aspx.

the code is

response.redirect(customer.aspx)

at the same time, i would like to pass the Login ID to customer.aspx. what code should i use for the customer.aspx as well as login.aspx in order to perform such function?

thanks

christeneThere are several options, of which just a few are:

1. Pass it in the URL
2. Store it in a session variable
3. Send it to the user's machine in a cookie.

Hope this helps,
Russ
well.........

my login is a button.
how i implement URL elements in a button control?

how do we use session variable?..i am not sure abt this....

hope u can explain futher...thanks a lot...

christene
What do you mean "My login is a button"? Can you tell me exactly what you have going on?
haha.....it means....

after the user type in the user name n password...they will click on a LOGIN BUTTON in order to log in....

well,i have done some testing using URL and it works...

response.redirect(customer.aspx?cusName = "& CustomerName &"")

on the customer.aspx,

Request.params("cusName")

right?

however, can u pls explain what is session variable?...i have heard about this but not sure what it is and how it works.....can u?

thanks...

christene
There is a good article on MSDN should you passing server control values between pages at
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconpassingservercontrolvaluesbetweenpages.asp

Saturday, March 24, 2012

Passing Variables

This is from an earlier thread:

www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=133432

I am getting zero for my variable the second time it accesses the subrountine. It is obivous to me that its getting initialized every time, thus reseting it to zero.

How can I initialize the variable once and not have it re-initialized every time? What is the syntax?

Thanks for the help,

-JJust a swag, but are you checking "IsPostBack" in your PageLoad before initializing the variables?

Another thing to remember is that no variables survive a roundtrip to the client. You have to save them somewhere (viewstate, session), and restore their values each time.
I am not sure what you are asking? I am checking for IsPostBack in Page Load, but the variable that is in question is not declared up there, but within the subroutine. When I used to program in PICK it was always good practice to declare your variables at the top of the program and you never had to declare them again. Seems in ASP.NET you, its geared for option explicit, which makes it difficult sometimes when you have to declare everytime you want to use the same variable more than one place in the program.

I did think of this earlier although, but I was getting an undeclared error when I intialized it in the page load.

How do you use the viewstate to handle something like this?

Thanks for you help so far,

-J
In VB.NET or C#.net, you can declare variables at the "class" level. For example:


Public Class MyPage
Inherits System.Web.UI.Page

Protected dateBegin As System.DateTime
Protected dateEnd As System.DateTime
etc.

These will be accessable from anywhere in your code-behind, or from the ASPX page that inherits from the code-behind. Typically, then, within a function or sub, you can then use these without declaring them, but they will, of course, need to be initialized first. It is good practice to _only_ use this kind of variable for things that will be needed throughout the class. For variables that are only used within a function, you declare them withing the function. These go out of scope when you exit the function.

Viewstate is pretty simple to use. To store something there:
Viewstate("dateBegin") = dateBegin

To get it back, you need to cast the type:
dateBegin = CType(Viewstate("dateBegin"), System.DateTime)

========

Typically, with your begin/end variables you might do something like:


In page-load:
If Not IsPostBack Then
dateBegin = Date.Today()
dateEnd = dateBegin
Viewstate("dateBegin") = dateBegin
Else
dateBegin = CType(Viewstate("dateBegin"), DateTime)
dateEnd = Date.Today()
End If

Now, if you declared the two dates as "Protected... " at the class level, you can access them in any function that runs after PageLoad in the processing cycle. (and postback handlers DO run after PageLoad).

HTH,
Wow, thank you so much for this explanation. I've also been searching and couldn't find why my variable values where disappearing.

passing variables between two different windows

Hello. I'm a rookie ASP VBScripter and am having a difficult time scripting
the following scenario:

I have an index.asp file that has a multi-line text box and a button of type
button. When the button is clicked a window is spawned with change.asp as
its source. There is a form with a few text boxes and with a button of type
submit and a cancel button of type button that just closes the window. What
I want to happen is I want the information entered in change.asp to be added
into the multi-line text box in index.asp when the submit button is clicked
in change.asp. Here are the index.asp and change.asp files:

//--index.asp----
<html>
<head>
<title>Product Listing</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head
<script language="JavaScript" type="text/javascript">
self.moveTo(0,0);
self.resizeTo(screen.availWidth,screen.availHeight );
function changeInfo()
{
var x = (screen.width - 400) / 2;
var y = (screen.height - 320) / 2;
var myWin = window.open("change.asp",null,"scrollbars=no, toolbar=no,
resizable=no, width=400, height=300, left="+x+" top="+y)
}
</script
<body>
<table width="554" cellpadding="5">
<tr>
<td width="400"><img src="http://pics.10026.com/?src=images/HouseValue 031.jpg" width="400"
height="300"></td>
<td width="3027" valign="top"><form name = "picInfo" id = "picInfo">
<textarea name="txtInfo" id="txtInfo" cols="40" rows="10"
wrap="soft" readonly>Press "Change" to enter information.</textarea>
<br>
<input type="button" value="Change" id="btnChange" name="btnChange"
onClick="javascript:changeInfo()">
</form></td>
</tr>
</table>
</body>
</html>
//-----------
//---change.asp------
<html>
<head>
<title>Edit Product Description</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<script language="JavaScript" type="text/javascript">
function Cancel()
{
window.close();
}
</script>
<body>
<form name="frmChange" id="frmChange" method="post">
<table>
<tr>
<td align="right">Product Name:</td>
<td align="left"><input type="text" name="txtProduct" id="txtProduct"
size="40"></td>
</tr>
<tr>
<td align="right">Model #:</td>
<td align="left"><input type="text" name="txtModel" id="txtModel"
size="40"></td>
</tr>
<tr>
<td align="right">Value:</td>
<td align="left"><input type="text" name="txtValue" id="txtValue"></td>
</tr>
<tr>
<td align="right">Category:</td>
<td align="left"><select name="mnuCategory" id="mnuCategory">
<option selected value="NULL">Choose category...</option>
<option value="Furniture">Furniture</option>
<option value="Electronics">Electronics</option>
<option value="Home Media">Home Media</option>
<option value="Jewlery">Jewlery</option>
</select></td>
</tr>
<tr>
<td align="right" valign="top">Misc. Information:</td>
<td align="left"><textarea name="txtMisc" id="txtMisc" cols="30"
rows="5"></textarea></td>
</tr>
</table>
<br>
<center>
<input type="submit" name="btnSubmitChanges" id="btnSubmitChanges"
value="Submit">
<input type="button" name="btnCancel" id="btnCancel" value="Cancel"
onClick="javascript:Cancel()">
</center>
</form>
</body>
</html>
//--------

I've been messing with it for a day now and I have been unable to pass
variables from change.asp into index.asp. Any help would be much
appreciated.

~Les PeabodySounds like you'll be needing to use some client side javascript.
You can open a new window using javascript such as this:
a=window.open('MyPage.aspx','_new')
There are all kinds of options for setting window properties such as window
size and toolbar visibility.
Here's more info:
http://msdn.microsoft.com/workshop/...hods/open_0.asp

From that new window you can reference the original parent window with
this javascript reference:

Here's an example:
window.opener.document.form1.mytextbox.value = 'whatever';

Here's more info:
http://www.mozilla.org/docs/dom/dom...ndow_ref77.html

--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Les Peabody" <les.peabody@.geo-sync.com> wrote in message
news:eGyXyv62DHA.1184@.TK2MSFTNGP10.phx.gbl...
> Hello. I'm a rookie ASP VBScripter and am having a difficult time
scripting
> the following scenario:
> I have an index.asp file that has a multi-line text box and a button of
type
> button. When the button is clicked a window is spawned with change.asp as
> its source. There is a form with a few text boxes and with a button of
type
> submit and a cancel button of type button that just closes the window.
What
> I want to happen is I want the information entered in change.asp to be
added
> into the multi-line text box in index.asp when the submit button is
clicked
> in change.asp. Here are the index.asp and change.asp files:
> //--index.asp----
> <html>
> <head>
> <title>Product Listing</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
> <script language="JavaScript" type="text/javascript">
> self.moveTo(0,0);
> self.resizeTo(screen.availWidth,screen.availHeight );
> function changeInfo()
> {
> var x = (screen.width - 400) / 2;
> var y = (screen.height - 320) / 2;
> var myWin = window.open("change.asp",null,"scrollbars=no, toolbar=no,
> resizable=no, width=400, height=300, left="+x+" top="+y)
> }
> </script>
> <body>
> <table width="554" cellpadding="5">
> <tr>
> <td width="400"><img src="http://pics.10026.com/?src=images/HouseValue 031.jpg" width="400"
> height="300"></td>
> <td width="3027" valign="top"><form name = "picInfo" id = "picInfo">
> <textarea name="txtInfo" id="txtInfo" cols="40" rows="10"
> wrap="soft" readonly>Press "Change" to enter information.</textarea>
> <br>
> <input type="button" value="Change" id="btnChange" name="btnChange"
> onClick="javascript:changeInfo()">
> </form></td>
> </tr>
> </table>
> </body>
> </html>
> //-----------
> //---change.asp------
> <html>
> <head>
> <title>Edit Product Description</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
> <script language="JavaScript" type="text/javascript">
> function Cancel()
> {
> window.close();
> }
> </script>
> <body>
> <form name="frmChange" id="frmChange" method="post">
> <table>
> <tr>
> <td align="right">Product Name:</td>
> <td align="left"><input type="text" name="txtProduct" id="txtProduct"
> size="40"></td>
> </tr>
> <tr>
> <td align="right">Model #:</td>
> <td align="left"><input type="text" name="txtModel" id="txtModel"
> size="40"></td>
> </tr>
> <tr>
> <td align="right">Value:</td>
> <td align="left"><input type="text" name="txtValue" id="txtValue"></td>
> </tr>
> <tr>
> <td align="right">Category:</td>
> <td align="left"><select name="mnuCategory" id="mnuCategory">
> <option selected value="NULL">Choose category...</option>
> <option value="Furniture">Furniture</option>
> <option value="Electronics">Electronics</option>
> <option value="Home Media">Home Media</option>
> <option value="Jewlery">Jewlery</option>
> </select></td>
> </tr>
> <tr>
> <td align="right" valign="top">Misc. Information:</td>
> <td align="left"><textarea name="txtMisc" id="txtMisc" cols="30"
> rows="5"></textarea></td>
> </tr>
> </table>
> <br>
> <center>
> <input type="submit" name="btnSubmitChanges" id="btnSubmitChanges"
> value="Submit">
> <input type="button" name="btnCancel" id="btnCancel" value="Cancel"
> onClick="javascript:Cancel()">
> </center>
> </form>
> </body>
> </html>
> //--------
> I've been messing with it for a day now and I have been unable to pass
> variables from change.asp into index.asp. Any help would be much
> appreciated.
> ~Les Peabody
That worked great, I figured there would be a way to access the parent
window. Thanks Steve.

~Les Peabody

"Steve C. Orr [MVP, MCSD]" <Steve@.Orr.net> wrote in message
news:%23tVzF162DHA.1752@.tk2msftngp13.phx.gbl...
> Sounds like you'll be needing to use some client side javascript.
> You can open a new window using javascript such as this:
> a=window.open('MyPage.aspx','_new')
> There are all kinds of options for setting window properties such as
window
> size and toolbar visibility.
> Here's more info:
http://msdn.microsoft.com/workshop/...hods/open_0.asp
> From that new window you can reference the original parent window with
> this javascript reference:
> Here's an example:
> window.opener.document.form1.mytextbox.value = 'whatever';
> Here's more info:
> http://www.mozilla.org/docs/dom/dom...ndow_ref77.html
> --
> I hope this helps,
> Steve C. Orr, MCSD
> http://Steve.Orr.net
> Hire top-notch developers at http://www.able-consulting.com
>
> "Les Peabody" <les.peabody@.geo-sync.com> wrote in message
> news:eGyXyv62DHA.1184@.TK2MSFTNGP10.phx.gbl...
> > Hello. I'm a rookie ASP VBScripter and am having a difficult time
> scripting
> > the following scenario:
> > I have an index.asp file that has a multi-line text box and a button of
> type
> > button. When the button is clicked a window is spawned with change.asp
as
> > its source. There is a form with a few text boxes and with a button of
> type
> > submit and a cancel button of type button that just closes the window.
> What
> > I want to happen is I want the information entered in change.asp to be
> added
> > into the multi-line text box in index.asp when the submit button is
> clicked
> > in change.asp. Here are the index.asp and change.asp files:
> > //--index.asp----
> > <html>
> > <head>
> > <title>Product Listing</title>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > </head>
> > <script language="JavaScript" type="text/javascript">
> > self.moveTo(0,0);
> > self.resizeTo(screen.availWidth,screen.availHeight );
> > function changeInfo()
> > {
> > var x = (screen.width - 400) / 2;
> > var y = (screen.height - 320) / 2;
> > var myWin = window.open("change.asp",null,"scrollbars=no, toolbar=no,
> > resizable=no, width=400, height=300, left="+x+" top="+y)
> > }
> > </script>
> > <body>
> > <table width="554" cellpadding="5">
> > <tr>
> > <td width="400"><img src="http://pics.10026.com/?src=images/HouseValue 031.jpg" width="400"
> > height="300"></td>
> > <td width="3027" valign="top"><form name = "picInfo" id = "picInfo">
> > <textarea name="txtInfo" id="txtInfo" cols="40" rows="10"
> > wrap="soft" readonly>Press "Change" to enter information.</textarea>
> > <br>
> > <input type="button" value="Change" id="btnChange" name="btnChange"
> > onClick="javascript:changeInfo()">
> > </form></td>
> > </tr>
> > </table>
> > </body>
> > </html>
> > //-----------
> > //---change.asp------
> > <html>
> > <head>
> > <title>Edit Product Description</title>
> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> > </head>
> > <script language="JavaScript" type="text/javascript">
> > function Cancel()
> > {
> > window.close();
> > }
> > </script>
> > <body>
> > <form name="frmChange" id="frmChange" method="post">
> > <table>
> > <tr>
> > <td align="right">Product Name:</td>
> > <td align="left"><input type="text" name="txtProduct" id="txtProduct"
> > size="40"></td>
> > </tr>
> > <tr>
> > <td align="right">Model #:</td>
> > <td align="left"><input type="text" name="txtModel" id="txtModel"
> > size="40"></td>
> > </tr>
> > <tr>
> > <td align="right">Value:</td>
> > <td align="left"><input type="text" name="txtValue" id="txtValue"></td>
> > </tr>
> > <tr>
> > <td align="right">Category:</td>
> > <td align="left"><select name="mnuCategory" id="mnuCategory">
> > <option selected value="NULL">Choose category...</option>
> > <option value="Furniture">Furniture</option>
> > <option value="Electronics">Electronics</option>
> > <option value="Home Media">Home Media</option>
> > <option value="Jewlery">Jewlery</option>
> > </select></td>
> > </tr>
> > <tr>
> > <td align="right" valign="top">Misc. Information:</td>
> > <td align="left"><textarea name="txtMisc" id="txtMisc" cols="30"
> > rows="5"></textarea></td>
> > </tr>
> > </table>
> > <br>
> > <center>
> > <input type="submit" name="btnSubmitChanges" id="btnSubmitChanges"
> > value="Submit">
> > <input type="button" name="btnCancel" id="btnCancel" value="Cancel"
> > onClick="javascript:Cancel()">
> > </center>
> > </form>
> > </body>
> > </html>
> > //--------
> > I've been messing with it for a day now and I have been unable to pass
> > variables from change.asp into index.asp. Any help would be much
> > appreciated.
> > ~Les Peabody

Wednesday, March 21, 2012

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
>