473,791 Members | 2,711 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass parameters to the code behind.

Hello.

In Visual Studio 2008,
there is on the toolbox -login -login,
which create a login form.

On that form there is a LoginButton, which click on it is evented on the
"default.aspx.v b" codeBehind.

How can I use the value on the codeBehind (default.aspx.v b) of UserName &
Password that are on "default.as px" ?

Thanks :)
Oct 13 '08 #1
5 2541
You can use the UserName and Password properties if you meant you would like
to read those values ("use" is pretty vague). You could use the authenticate
event if you are trying to implement a custom authentication scheme.

Also make sure you checked the documentation before posting :
http://msdn.microsoft.com/en-us/libr...ols.login.aspx

--
Patrice
"Mr. X." <no_spam_please @nospam_please. coma écrit dans le message de
groupe de discussion : eS************* *@TK2MSFTNGP03. phx.gbl...
Hello.

In Visual Studio 2008,
there is on the toolbox -login -login,
which create a login form.

On that form there is a LoginButton, which click on it is evented on the
"default.aspx.v b" codeBehind.

How can I use the value on the codeBehind (default.aspx.v b) of UserName &
Password that are on "default.as px" ?

Thanks :)
Oct 13 '08 #2
The "code behind" cannot use the UserName nor the Password as it.
Maybe via request.somethi ng ?

Here is the code (that automatically generated by VS 2008) :
<%@ Page Language="vb" AutoEventWireup ="false" CodeBehind="Log in.aspx.vb"
Inherits="CSMMa nager._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

<title>Untitl ed Page</title>

<style type="text/css">

#Text1

{

width: 248px;

margin-right: 31px;

}

#Text2

{

width: 247px;

margin-right: 31px;

}

</style>

</head>

<body>

<form id="form1" runat="server">

<asp:Login ID="Login1" runat="server" Width="395px">

<LayoutTemplate >

<table align="right" border="0" cellpadding="1" cellspacing="0" dir="rtl"

style="border-collapse:collap se;">

<tr>

<td>

<table border="0" cellpadding="0" >

<tr>

<td align="center" colspan="2">

Connect~</td>

</tr>

<tr>

<td align="right">

<asp:Label ID="UserNameLab el" runat="server"
AssociatedContr olID="UserName" >User Name:</asp:Label>

</td>

<td>

<asp:TextBox ID="UserName" runat="server"> </asp:TextBox>

<asp:RequiredFi eldValidator ID="UserNameReq uired" runat="server"

ControlToValida te="UserName" ErrorMessage="U ser Name is required."

ToolTip="User Name is required."
ValidationGroup ="Login1">*</asp:RequiredFie ldValidator>

</td>

</tr>

<tr>

<td align="right">

<asp:Label ID="PasswordLab el" runat="server"
AssociatedContr olID="Password" >Password:</asp:Label>

</td>

<td>

<asp:TextBox ID="Password" runat="server" TextMode="Passw ord"></asp:TextBox>

<asp:RequiredFi eldValidator ID="PasswordReq uired" runat="server"

ControlToValida te="Password" ErrorMessage="P assword is required."

ToolTip="Passwo rd is required."
ValidationGroup ="Login1">*</asp:RequiredFie ldValidator>

</td>

</tr>

<tr>

<td colspan="2">

<asp:CheckBox ID="RememberMe " runat="server"

Text="remember password" />

</td>

</tr>

<tr>

<td align="center" colspan="2" style="color:Re d;">

<asp:Literal ID="FailureText " runat="server"
EnableViewState ="False"></asp:Literal>

</td>

</tr>

<tr>

<td align="right" colspan="2">

<asp:Button ID="LoginButton " runat="server" CommandName="Lo gin"

onclick="LoginB utton_Click" Text="Connect" ValidationGroup ="Login1"

style="height: 26px" />

</td>

</tr>

</table>

</td>

</tr>

</table>

</LayoutTemplate>

</asp:Login>

</form>

</body>

</html>

In CodeBehind : "Login.aspx .vb"

=============== ===========

Imports System.Data.Ole Db

Partial Public Class _Default

Inherits System.Web.UI.P age

Protected Sub LoginButton_Cli ck(ByVal sender As Object, ByVal e As
EventArgs)

Dim s As String

MsgBox(UserName .text)

....

End Sub

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
Handles Me.Load

End Sub

End Class

What should I put instead of the line MsgBox(UserName .text) ?

Thanks :)
Oct 14 '08 #3
Have you tried Login1.UserName and Login1.Password ?

--
Patrice


Oct 14 '08 #4
Yes, that works.

I don't understand why cannot I use
UserName (It has an ID),
but I should Use Login1.UserName ?

Thanks :)
Oct 14 '08 #5
Hi,

Have a look to User.Identity.I sAuthenticated

http://msdn.microsoft.com/en-us/libr...er(VS.71).aspx

If that is to difficult use the normal session to save those (as it was done
in past)

Cor
"Mr. X." <no_spam_please @nospam_please. comschreef in bericht
news:eS******** ******@TK2MSFTN GP03.phx.gbl...
Hello.

In Visual Studio 2008,
there is on the toolbox -login -login,
which create a login form.

On that form there is a LoginButton, which click on it is evented on the
"default.aspx.v b" codeBehind.

How can I use the value on the codeBehind (default.aspx.v b) of UserName &
Password that are on "default.as px" ?

Thanks :)

Oct 14 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
21637
by: Zlatko Matiæ | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the server ? Is it possible to use parameters in pass-through queries ? An additional question: Is it possible to connect to a database on MySQL or PostgreSQL using ADO ? Is it possible to execute pass-through queries with parameters, using ADO...
0
3324
by: Zlatko Matiæ | last post by:
Hi everybody! Recently I was struggling with client/server issues in MS Access/PostgreSQL combination. Although Access is intuitive and easy to use desktop database solution, many problems appear when someone is trying to use it as front-end for real server database systems such as PostgreSQL or MySQL. One of these problems is regarding pass-through queries and parameters. I wanted to have all the code on client, while executing it on...
9
2334
by: Frank Rizzo | last post by:
I've got a number of user controls on the web page. How can I pass some data to it? I don't see where the user control is instantiated in the page code-behind page. Thanks.
4
8974
by: Rod | last post by:
I've got 2 ASP.NET WebPages that I've written in VB.NET 2003. One of them has several controls on it, including at the bottom of the page an IFrame. The second ASP.NET page is supposed to have parameters passed to it in the query string. My problem is that I cannot figure out how to programmatically change the parameters that are passed to the second ASP.NET page, from the first ASP.NET page. How is this done? Rod
12
2931
by: Phil Certain | last post by:
Hi, I'm trying to do something very simple...or at least it should be. I have created a host page (gen.aspx) and a very simple user control (us.ascx). The corresponding code-behind files are gen.aspx.vb and uc.ascx.vb. With simple html or self contained vb in the user control, everything is fine and dandy. So the next stage is to pass back a simple variable from the user control to the host page. I used VS.NEt to create the files.
2
19795
by: phil | last post by:
Hi, I want to put a recordset in a gridview but i don't know how to pass the value of the variable in the 'where' statement. The value of the variable is set in the code-behind. i added a tag <selectParameters> but i don't know which elements are needed and how... This is my aspx file: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\mydb.mdb"
5
3049
by: slowmotiongenius | last post by:
All- I have established an adodb recordset in my code-behind, and I need to pass it to the aspx file. I can't seem to figure out if there is a way to do this. I see you can pass a string over using the GetCallbackResult, but a recordset won't pass this way. Any ideas??? Thanks
1
8420
by: peridian | last post by:
This is more of a general question, but I didn't know where to post it. Since Java is an example of a language which does this, I thought here would work. Coming from a C++ background, having used VBA/VB6 quite a bit, and a number of scripting languages with similar traits, like php, I had grown accustomed to optional parameters in my functions. I recently found out that certain modern languages do not support these, namely Java and...
12
11112
by: raylopez99 | last post by:
Keywords: scope resolution, passing classes between parent and child forms, parameter constructor method, normal constructor, default constructor, forward reference, sharing classes between forms. Here is a newbie mistake that I found myself doing (as a newbie), and that even a master programmer, the guru of this forum, Jon Skeet, missed! (He knows this I'm sure, but just didn't think this was my problem; LOL, I am needling him) If...
0
9669
marktang
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...
0
9515
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,...
0
10426
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10207
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9993
tracyyun
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...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.