Thursday, March 29, 2012
Passing Values Between Web Forms Pages
retrieve data into local tables (Paradox table-files on the client's
disk) and work on them before saving them back to the server. What is
the approach for this in asp.net? The comments in MSDN on using the
session object are scary, imagining that several users at the same
time will use plenty of space on the server's memory! Or is it
realistic to memorize the data in a page and access them from the
following pages?
Thank for your help!You can add objects to the HttpContext of the current Page, and then use
Server.Transfer to transfer to the next page. The HttpContext is transferred
as well, and you can pull the data from the original page out of that.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Big things are made up of
lots of little things.
"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307250620.7aed635b@.posting.google.c om...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
Here's a nice, simple way to pass values from one page to another:
(VB.NET code)
'Add data to the context object before transferring
Context.Items("myParameter") = x
Server.Transfer("WebForm2.aspx")
Then, in WebForm2.aspx:
'Grab data from the context property
Dim x as Integer = CType(Context.Items("myParameter"),Integer)
Of course there are a number of ways to pass values from one page to
another, such as using the querystring, cookies, session,
context, saving to a temporary table in the database between each page, etc.
You'll have to decide which technique is best for your application.
Here are several good articles on the subject to help you decide.
http://msdn.microsoft.com/msdnmag/i...te/default.aspx
http://www.aspalliance.com/kenc/passval.aspx
http://www.dotnetjunkies.com/tutori...?tutorialid=600
http://www.dotnetbips.com/displayarticle.aspx?id=79
--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307250620.7aed635b@.posting.google.c om...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
There are a lot of options to transferring values between pages: Session
like you've mentioned, The querystring (of course), But you may want to look
into Server.Transfer and the Context Object.
I hope this leads you in the right direction.
--
S. Justin Gengo, MCP
Web Developer
Free code library at:
www.aboutfortunate.com
"Out of chaos comes order."
Nietzche
"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307250620.7aed635b@.posting.google.c om...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
Actually what I want to transfer between forms is huge tables... do
you think it is appropriate to use the server.transfer?
cgian31@.katamail.com (cgia) wrote in message news:<b35db8fd.0307250620.7aed635b@.posting.google.com>...
> I am porting an old client/server application to asp.net. I used to
> retrieve data into local tables (Paradox table-files on the client's
> disk) and work on them before saving them back to the server. What is
> the approach for this in asp.net? The comments in MSDN on using the
> session object are scary, imagining that several users at the same
> time will use plenty of space on the server's memory! Or is it
> realistic to memorize the data in a page and access them from the
> following pages?
> Thank for your help!
Yes, that seems like one of the more efficient solutions for this particular
problem.
--
I hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net
"cgia" <cgian31@.katamail.com> wrote in message
news:b35db8fd.0307251918.2ad13d06@.posting.google.c om...
> Actually what I want to transfer between forms is huge tables... do
> you think it is appropriate to use the server.transfer?
>
> cgian31@.katamail.com (cgia) wrote in message
news:<b35db8fd.0307250620.7aed635b@.posting.google.com>...
> > I am porting an old client/server application to asp.net. I used to
> > retrieve data into local tables (Paradox table-files on the client's
> > disk) and work on them before saving them back to the server. What is
> > the approach for this in asp.net? The comments in MSDN on using the
> > session object are scary, imagining that several users at the same
> > time will use plenty of space on the server's memory! Or is it
> > realistic to memorize the data in a page and access them from the
> > following pages?
> > Thank for your help!
passing values from a web page into windows form application
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)
Saturday, March 24, 2012
Passing Variable to XSLT
using to create an export file. Using XslTransform class I have a form
that collects data and executes a stored procedure to pull information
from my SQL Database. I would like to include information from a
textbox on the form in the XSL stylesheet. Can some one please explain
how I can pull information from my code and pass it to the stylesheet?
Thanks
CharlesRead this: http://msdn2.microsoft.com/en-us/library/ts9by56w.aspx
<cbanks@.bjtsupport.com> wrote in message
news:1133885799.818228.237430@.g49g2000cwa.googlegroups.com...
>I have a ASP.NET application written in VB.net 2003 with a form I am
> using to create an export file. Using XslTransform class I have a form
> that collects data and executes a stored procedure to pull information
> from my SQL Database. I would like to include information from a
> textbox on the form in the XSL stylesheet. Can some one please explain
> how I can pull information from my code and pass it to the stylesheet?
> Thanks
> Charles
>
One thing that comes to mind, though I'm sure I'm overcomplicating
it... is to make the XSLT an aspx page (you can specify the
appropriatae content-type in the codebehind) and pass it a query
paramater (MyXslt.xsl.aspx?Id=7). I do this with my ECMAScript
(JavaScript) at times like "GetFirefoxSVGInformation.js.aspx?id=314"
This would work clientside, but should be close on serverside too.
Peter,
Thanks for the quick reply! I'll work with that information.
Charles
Being new to all of this, I need to ask one more question. Once the
variable is passed, how do I insert it into my xslt?
<xsl:for-each select="PrintChecks/tblChecks">
<xsl:text>TRANS CHECK </xsl:text>
<xsl:text></xsl:text><xsl:value-of select="fldFirstName"/>
<xsl:text> </xsl:text><xsl:value-of select="fldLastName"/>
var needs to go here
...
/xsl:for-each
Thanks again.
I was able to figure everything out thanks to the link Peter sent.
Just goes to show ya that a little help from some one in these groups
goes a long way!
Thanks again!
Charles
Passing Variables between applications
Now I need to access the variables of one application from other application.
In other words I need to transfer the value of one variable from one application to another.
How can I do that ??Chapter 6 of ASP.NET Unleashed, "Using Code-Behind", goes into this (if you have the book). It basically discusses the ranges of public functions and variables (vs private, protected..) That is what you will want to reference to.
Basically, if you have a .CS file or, (i think the same is true when you compile)..
You have something like this (this is taken from the book)..
You CS file looks like
using System;namespace myComponents {
public class AdderProperties {
private int _firstValue;
private int _secondValue;public int FirstValue {
get {
return _firstValue;
}
set {
_firstValue = value;
}
}public int SecondValue {
get {
return _secondValue;
}
set {
_secondValue = value;
}
}int AddValues() {
return _firstValue + _secondValue;
}}
}
And you ASP.NET page looks like this
<%@. Import Namespace="myComponents" %
<script runat=server>
void Button_Click( object s, EventArgs e )
{
Adder myAdder = new Adder();myAdder.FirstValue = Int32.Parse(txtVal1.Text);
myAdder.SecondValue = Int32.Parse(txtVal2.Text);
lblOutput.Text = myAdder.AddValues().ToString();
}
</Script
<html>
<head><title>AddValues.aspx</title></head>
<body
<form Runat="Server"
Value 1:
<asp:TextBox
ID="txtVal1"
Runat="Server" /
<p
Value 2:
<asp:TextBox
ID="txtVal2"
Runat="Server" /
<p>
<asp:Button
Text="Add!"
OnClick="Button_Click"
Runat="Server" /
<p>
Output:
<asp:Label
ID="lblOutput"
Runat="Server" /
</form
</body>
</html
Is this what you are looking to do? Separate business(or w/e) logic from presentation? I am pretty sure that one application can pass information to another application using the same method.
You could do a POST (WebRequest/WebResponse objects) to a page in the "receiving" application. You could also put the data in some "shared" space (a database for example).
HTH...
Chris
but I think this example will work if both the applications are part of the same solution. What if both the applications are part of the different solutions.
Thanks,
azamsharp
What is
Adder myadder = new Adder();
should'nt this be :
AdderProperties adder = new AdderProperties()
Haha, yah.. I copied the wrong file :\ your Adder class should look like
using System;
namespace myComponents {
public class Adder {
public int FirstValue;
public int SecondValue;public int AddValues() {
return FirstValue + SecondValue;
}}
}
The original one I posted dealt with adding properties, too.
Hello, have u thought of sharing the same database ? then, you can store variables in one database and access it from multiple applications ?
regards
Wednesday, March 21, 2012
Passing variables values
I have a little complex question for you all, that I hope you can help me.
I have a windows application that comunicate with another dll's
applications. My Win app have some menus (like Outlook bar) and each menu
can have many icons or function as you want. This icons can call forms from
any dll app that I have too. Ok, so far so good... Know I want to have a
form that have a Web Browser control for calling a page that I made in
ASP.NET.
My Win app have the current user that is using app, the problem when I have
to pass the user Id value to the page in APS.NET.
How can I pass this value? How can I "comunicate" between Win and Web forms.
NOTE: I must say another thing: the Win app is in Visual Studio 6.0.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucayou can catch events and access the webbrowser dom. you could use standard
authencation on the asp.net site, or fill in a hidden field on the page
before post.
-- bruce (sqlwork.com)
"ruca" <ruuca@.iol.pt> wrote in message
news:uZnzx%23F2EHA.3336@.TK2MSFTNGP11.phx.gbl...
| Hi gurus,
| I have a little complex question for you all, that I hope you can help me.
|
| I have a windows application that comunicate with another dll's
| applications. My Win app have some menus (like Outlook bar) and each menu
| can have many icons or function as you want. This icons can call forms
from
| any dll app that I have too. Ok, so far so good... Know I want to have a
| form that have a Web Browser control for calling a page that I made in
| ASP.NET.
| My Win app have the current user that is using app, the problem when I
have
| to pass the user Id value to the page in APS.NET.
| How can I pass this value? How can I "comunicate" between Win and Web
forms.
|
| NOTE: I must say another thing: the Win app is in Visual Studio 6.0.
|
|
| --
| Programming ASP.NET with VB.NET
| Thank's (if you try to help me)
| Hope this help you (if I try to help you)
| ruca
|
|
Can you be more specific please? I don't uderstand very well. Sorry... :)
I forgot to tell you that the Win app already have a login. The only thing
that I want is to pass the user ID to the Web.
--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"bruce barker" <nospam_brubar@.safeco.com> escreveu na mensagem
news:u$BRqHJ2EHA.2192@.TK2MSFTNGP14.phx.gbl...
> you can catch events and access the webbrowser dom. you could use standard
> authencation on the asp.net site, or fill in a hidden field on the page
> before post.
> -- bruce (sqlwork.com)
>
> "ruca" <ruuca@.iol.pt> wrote in message
> news:uZnzx%23F2EHA.3336@.TK2MSFTNGP11.phx.gbl...
> | Hi gurus,
> | I have a little complex question for you all, that I hope you can help
> me.
> |
> | I have a windows application that comunicate with another dll's
> | applications. My Win app have some menus (like Outlook bar) and each
> menu
> | can have many icons or function as you want. This icons can call forms
> from
> | any dll app that I have too. Ok, so far so good... Know I want to have
> a
> | form that have a Web Browser control for calling a page that I made in
> | ASP.NET.
> | My Win app have the current user that is using app, the problem when I
> have
> | to pass the user Id value to the page in APS.NET.
> | How can I pass this value? How can I "comunicate" between Win and Web
> forms.
> |
> | NOTE: I must say another thing: the Win app is in Visual Studio 6.0.
> |
> |
> | --
> | Programming ASP.NET with VB.NET
> | Thank's (if you try to help me)
> | Hope this help you (if I try to help you)
> | ruca
> |
> |
Passing variables values
I have a little complex question for you all, that I hope you can help me.
I have a windows application that comunicate with another dll's
applications. My Win app have some menus (like Outlook bar) and each menu
can have many icons or function as you want. This icons can call forms from
any dll app that I have too. Ok, so far so good... Know I want to have a
form that have a Web Browser control for calling a page that I made in
ASP.NET.
My Win app have the current user that is using app, the problem when I have
to pass the user Id value to the page in APS.NET.
How can I pass this value? How can I "comunicate" between Win and Web forms.
NOTE: I must say another thing: the Win app is in Visual Studio 6.0.
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
rucayou can catch events and access the webbrowser dom. you could use standard
authencation on the asp.net site, or fill in a hidden field on the page
before post.
-- bruce (sqlwork.com)
"ruca" <ruuca@.iol.pt> wrote in message
news:uZnzx%23F2EHA.3336@.TK2MSFTNGP11.phx.gbl...
| Hi gurus,
| I have a little complex question for you all, that I hope you can help me.
|
| I have a windows application that comunicate with another dll's
| applications. My Win app have some menus (like Outlook bar) and each menu
| can have many icons or function as you want. This icons can call forms
from
| any dll app that I have too. Ok, so far so good... Know I want to have a
| form that have a Web Browser control for calling a page that I made in
| ASP.NET.
| My Win app have the current user that is using app, the problem when I
have
| to pass the user Id value to the page in APS.NET.
| How can I pass this value? How can I "comunicate" between Win and Web
forms.
|
| NOTE: I must say another thing: the Win app is in Visual Studio 6.0.
|
|
| --
| Programming ASP.NET with VB.NET
| Thank's (if you try to help me)
| Hope this help you (if I try to help you)
| ruca
|
|
Can you be more specific please? I don't uderstand very well. Sorry... :)
I forgot to tell you that the Win app already have a login. The only thing
that I want is to pass the user ID to the Web.
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
"bruce barker" <nospam_brubar@.safeco.com> escreveu na mensagem
news:u$BRqHJ2EHA.2192@.TK2MSFTNGP14.phx.gbl...
> you can catch events and access the webbrowser dom. you could use standard
> authencation on the asp.net site, or fill in a hidden field on the page
> before post.
> -- bruce (sqlwork.com)
>
> "ruca" <ruuca@.iol.pt> wrote in message
> news:uZnzx%23F2EHA.3336@.TK2MSFTNGP11.phx.gbl...
> | Hi gurus,
> | I have a little complex question for you all, that I hope you can help
> me.
> |
> | I have a windows application that comunicate with another dll's
> | applications. My Win app have some menus (like Outlook bar) and each
> menu
> | can have many icons or function as you want. This icons can call forms
> from
> | any dll app that I have too. Ok, so far so good... Know I want to have
> a
> | form that have a Web Browser control for calling a page that I made in
> | ASP.NET.
> | My Win app have the current user that is using app, the problem when I
> have
> | to pass the user Id value to the page in APS.NET.
> | How can I pass this value? How can I "comunicate" between Win and Web
> forms.
> |
> | NOTE: I must say another thing: the Win app is in Visual Studio 6.0.
> |
> |
> | --
> | Programming ASP.NET with VB.NET
> | Thank's (if you try to help me)
> | Hope this help you (if I try to help you)
> | ruca
> |
> |
>
Passport Authentication
I got little problem with authenticating .NET passports on my site.
I installed the SDK, created new application at microsoft, made some pages on site, ....
It looks like loggin in using a passport account works but it says im still not authenticated
Passport.HasTicket << before login = false, after login = true
Passport.IsAuthenticated <<< both cases false :( :( :(
I can find the problem for this :(
Because its for a large ecommerce site, i want to use passport authenticationI dont know if your problem is related to this, but did you know that you should buy the Passport license from MS? Read this thread (http://www.vbforums.com/showthread.php?s=&threadid=244500).
Friday, March 16, 2012
Password field is cleared after postback
I am developing a C# asp.net application.
I have a webform which contains 2 dropdowns and a textbox with
type="password".
On "SelectedIndexChanged" event of the first dropdown, there is a postback,
in order to fill the second dropdown according to the value selected in the
first dropdown.
The problem is that the password field which has been filled up before is
cleared after postback.
I know this is for security, but is there a way to keep the password'
Thank youdana lees wrote:
> Hello,
> I am developing a C# asp.net application.
> I have a webform which contains 2 dropdowns and a textbox with
> type="password".
> On "SelectedIndexChanged" event of the first dropdown, there is a
> postback, in order to fill the second dropdown according to the value
> selected in the first dropdown.
> The problem is that the password field which has been filled up before is
> cleared after postback.
> I know this is for security, but is there a way to keep the password'
> Thank you
Yes, you can add a "value" attribute to the password textbox on postback:
txtPassword.Attributes.Add("value", txtPassword.Text)
Ben
I have tried that and it didn't work. The field stayed empty...
"Ben Amada" <ben@.REpoMOweVErpick.com> wrote in message
news:OaFdNkA8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> dana lees wrote:
>
is
> Yes, you can add a "value" attribute to the password textbox on postback:
> txtPassword.Attributes.Add("value", txtPassword.Text)
> Ben
>
dana lees wrote:
> I have tried that and it didn't work. The field stayed empty...
Hmm... not sure why that doesn't work. Are you using .NET v2.0? I've done
it in v1.1 without any problems.
Another option is to manually set the value of the password field via
JavaScript. There are several ways to do this.
One way is to create a hidden input field. On postback, put the password in
the hidden input field (i.e. txtHiddenPwd.Value = txtPwd.Text). Then with a
startup script or via the body tag's onload attribute, set the value of the
password textbox to the value of the hidden input field.
Ben
I am using version 1.1.
On debug, I see that i do have the value of the password after postback, i
just can't set the textbox with that value.
I have tried also java script:
document.all.txtPassword.InnerText = "some text";
and this doesn't work as well...
I don't need to use a hidden textbox becuase i do have the value after
postback, i just can't set the textbox's value to that value...
"Ben Amada" <ben@.REpoMOweVErpick.com> wrote in message
news:u2Kz1wA8FHA.4076@.tk2msftngp13.phx.gbl...
> dana lees wrote:
>
> Hmm... not sure why that doesn't work. Are you using .NET v2.0? I've
done
> it in v1.1 without any problems.
> Another option is to manually set the value of the password field via
> JavaScript. There are several ways to do this.
> One way is to create a hidden input field. On postback, put the password
in
> the hidden input field (i.e. txtHiddenPwd.Value = txtPwd.Text). Then with
a
> startup script or via the body tag's onload attribute, set the value of
the
> password textbox to the value of the hidden input field.
> Ben
>
dana lees wrote:
> I am using version 1.1.
> On debug, I see that i do have the value of the password after postback, i
> just can't set the textbox with that value.
> I have tried also java script:
> document.all.txtPassword.InnerText = "some text";
> and this doesn't work as well...
> I don't need to use a hidden textbox becuase i do have the value after
> postback, i just can't set the textbox's value to that value...
Server-side you can't set the textbox's value to the password. However,
with JavaScript (client-side) you should be able to set the value of the
textbox with or without a hidden input field. Without a hidden input field,
you could simply add a runat="server" attribute to the <body> tag, then on
the server-side during a postback, you can add an "onload" attribute to the
body tag specifying the password value. Like this:
===== HTML =====
<body id="myBody" runat="server">
===== Code-Behind =====
myBody.Attributes.Add("onload", _
"document.getElementById('txtPassword').value = '" & _
txtPassword.Text & "'")
(the C# syntax should be similar)
Also, in the code-behind, if Visual Studio doesn't recognize the "myBody"
control (which happens sometimes), you'll probably have to manually add the
control declaration to the code-behind:
Dim myBody As HtmlControls.HtmlGenericControl
... or instead of adding an "onload" attribute to the body tag, you could
use the RegisterStartupScript method to set the password textbox value.
Ben
dana lees wrote:
> I have tried also java script:
> document.all.txtPassword.InnerText = "some text";
> and this doesn't work as well...
By the way, what do you mean that it "doesn't work as well"? How about :
document.getElementById('txtPassword').value = "some text";
Ben
It worked, when using
document.getElementById('txtPassword').value = "some text";
Thank you very much :-)
"Ben Amada" <ben@.REpoMOweVErpick.com> wrote in message
news:%23G3ExQB8FHA.3200@.TK2MSFTNGP11.phx.gbl...
> dana lees wrote:
>
> By the way, what do you mean that it "doesn't work as well"? How about :
> document.getElementById('txtPassword').value = "some text";
> Ben
>
Dana,
As Ben suggested you can use assword.Attributes.Add("value",
txtPassword.Text) to set the password .But instead of txtPassword.Text you
should retrieve password text using
txtPassword.Attributes["value"].ToString().
"dana lees" wrote:
> I have tried that and it didn't work. The field stayed empty...
> "Ben Amada" <ben@.REpoMOweVErpick.com> wrote in message
> news:OaFdNkA8FHA.3804@.TK2MSFTNGP12.phx.gbl...
> is
>
>
Check out:
http://groups.google.com/group/micr...de23fa30643fa4e
and
http://groups.google.com/group/micr...f9f3be06c4f0396
(watch for link brakage). Basically, you need to reset the value manually
via Password.Attributes.Add("value", Password.Text) or something
karl
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!
"dana lees" <danal@.idc.ac.il> wrote in message
news:%23jWQj9$7FHA.4036@.TK2MSFTNGP11.phx.gbl...
> Hello,
> I am developing a C# asp.net application.
> I have a webform which contains 2 dropdowns and a textbox with
> type="password".
> On "SelectedIndexChanged" event of the first dropdown, there is a
> postback,
> in order to fill the second dropdown according to the value selected in
> the
> first dropdown.
> The problem is that the password field which has been filled up before is
> cleared after postback.
> I know this is for security, but is there a way to keep the password'
> Thank you
>