|
thanks for your response. I am trying with that code. But my values are in textboxes. can you tll me exact syntax to assign textbox values to param1 ans param2?
|
|
|
|
|
Oh, man...
var param1 = document.getElementById('textBox1').value;
obviously it doesnt have to be called param1.
Please read up on javascript, seems like you need it.
Good luck.
var question = (_2b || !(_2b));
|
|
|
|
|
I used this statement to pass values
var param1 = document.getElementById('textBox1').value;
but it dost not passing anything i am getting null value.
|
|
|
|
|
Oh, come on.
it's not my fault your control does not have any text in it.
Where are you declaring the param1 variable, anyway?
Where are you accessing it from?
Is your control's ID textBox1 ?
Either put some more code out here or google for it and figure it out yourself.
I really do recommend the latter, too.
var question = (_2b || !(_2b));
|
|
|
|
|
i have written a code for login control but it generate the following error
Server Error in '/' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0161: 'ASP.login_aspx.SiteLevelCustomAuthenticationMethod(string, string)': not all code paths return a value
Source Error:
[No relevant source lines]
Source File: Line: 0
Microsoft (R) Visual C# 2008 Compiler version 3.5.21022.8
for Microsoft (R) .NET Framework version 3.5
Copyright (C) Microsoft Corporation. All rights reserved.
e:\New Folder (2)\WebApplication1\WebApplication1\login.aspx(15,14): error CS0161: 'ASP.login_aspx.SiteLevelCustomAuthenticationMethod(string, string)': not all code paths return a value
the code is
database name pubs and table name pswd
where columns are User and pswd
]]>
]]>
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
bool Authenticated = false;
Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password);
e.Authenticated = Authenticated;
if (Authenticated == true)
{
//Response.Redirect();
}
}
private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password)
{
SqlCommand cmdSelect;
bool boolReturnValue = false;
string strConnection = "@Server=localhost;Integrated Security=SSPI; Database=Pubs";
SqlConnection Connection = new SqlConnection(strConnection);
cmdSelect = new SqlCommand( "Select * From pswd", Connection );
SqlDataReader Dr;
Connection.Open();
Dr = cmdSelect.ExecuteReader();
while (Dr.Read())
{
if ((UserName == Dr["user"].ToString()) & (Password == Dr["Pswd"].ToString()))
{
boolReturnValue = true;
}
Dr.Close();
return boolReturnValue;
}
}
<asp:login id="Login1" runat="server" onauthenticate="Login1_Authenticate" xmlns:asp="#unknown">
|
|
|
|
|
rosae619 wrote: 'ASP.login_aspx.SiteLevelCustomAuthenticationMethod(string, string)': not all code paths return a value
Doesn't this say that SiteLevelCustomAuthenticationMethod is not returning something when it should ?
rosae619 wrote: while (Dr.Read())
{
if ((UserName == Dr["user"].ToString()) & (Password == Dr["Pswd"].ToString()))
{
boolReturnValue = true;
}
Dr.Close();
return boolReturnValue;
}
You have closed the while loop at wrong place.
|
|
|
|
|
Hi,
I'm new in ASP.NET and need some help with my problem. I need to convert some HTML tags to Microsoft Office Word 2003's XML format. Is there any built-in component from .NET that can do this?
Thanks in advance for your help.
|
|
|
|
|
All,
I am looking for a mechanism which makes use of "Forms authentication" and "Role based authorization".
Requirement is
my application should validate users belonging to different groups "Admin,guest,developer" and each group may consist of no of users.
for ex: if i(developer) logs in with my id and pwd i should be redirected to web pages that are specific to me, likewise for admin and guest too.
i am considering option of storing credentials in sessions and fetch the roles from db for access.
Is this a feasible option.
can anyone guide me?
Thanks
Mukkanti
|
|
|
|
|
Look up bitmasking, it will be of great help for you.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
hi can you be more specific plz..
Thanks
Mukkanti
|
|
|
|
|
Hello there
I'm having this registration form with 7 fields of real_name, user_name, email, password, city, webpage and signiture, I want my users to fill in this form and then after submitting the form I want to send them an activation email. my database has mentioned fields and also id (using identity) and verfy_user with default value of 0 (which means not).
2 questions are here for me:
1- how can I send activation email (simply?)
2- how can I prevent unactivate users from logging in?
your responses will be highly appriciated
Proper Prepration Prevents Poor Performance! h
|
|
|
|
|
netsooz (Amir Hamidi) wrote: 1- how can I send activation email (simply?)
Look up System.Web.Mail or System.Net.Mail.
There's loads of Smtp classes in there. And they're fairly simple.
netsooz (Amir Hamidi) wrote: 2- how can I prevent unactivate users from logging in?
Add a bit field in your users table (e.g. IsActive) and set it to true, when the user you're sending an activation email to clicks on the link in that email.
var question = (_2b || !(_2b));
|
|
|
|
|
1. First user fill the registration form.
2. User Click on the submit button.
3. On submit button click, you send him a activation mail for his account.
Now Following is my suggestion for your question.
netsooz (Amir Hamidi) wrote: 1- how can I send activation email (simply?)
Now, I will suggest, add one more filed called GUID in the DB. While sending the mail add the GUID with the corresponding user in the database and send the activation url.
Send a URL link with the email like
http://yourwebsite.com/Verification.aspx?Guid="AFDFASDFrwerwSDF@423"
Now, This GUID will ensure that, weather the user coming from the proper source or not. When user hits the URL, Read the Query String and verify the user GUID from the database. Now if its valid, then set the verfy_user filed to 1 and redirect user to Home Page.
netsooz (Amir Hamidi) wrote: 2- how can I prevent unactivate users from logging in?
During login, Check verfy_user field along with the User ID and Password. If user ID and password matched but verfy_user is still 0, then throw a message that Please activate your account.
Hope this will helps you to move ahead.
Good luck.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Good answer, but just for the record:
Abhijit Jana wrote: add one more filed called GUID
filed - as in my glass has been filed with wine [sic]
field - as in my database field is "Username"
Don't worry though. Most English people get confused with these english words which sound (and often look) the same but have different meanings.
|
|
|
|
|
Filed actually means like a paper has been filed in a filing cabinet.
Filled is filled with wine...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Yes, I confused things more. Im a douche.
|
|
|
|
|
Sorry about that.
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
You simply made a spelling mistake, he even made one :P
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
Yes, notice I had [sic] after the sentence. I was using filed as it sounds not as its spelt.
|
|
|
|
|
No need to be sorry Abhijit, you gacve an excellent answer I was just pointing out a possible misunderstanding of the right English word to use... It seems I confused things more using your spelling of filed to mean filled instead of filed.
I hate English. I want to speak a cooler, less obtuse, language.
|
|
|
|
|
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi all,
i am kind new to ASP.NET / C#, i wonder if is it possible to handle the Left mouse button down / up events for a given asp.net control.
In particular, i want to change the ImageUrl in a ImageButton when the user clics down on it, and then change it again when the clic up event comes, to simulate a "push down" effect on the ImageButton image.
Is it doable? How?
Thanks a lot.
|
|
|
|
|
Well I would employ javascript to do that, actually, like this:
In your code behind, add this line(in Page_Load, or wherever):
ImageButton1.Attributes.Add("onmousedown", "OnMouseDownButton()");
On your aspx page (somewhere in the head tag, or in an .js file if you have one linked, add this:
function OnMouseDownButton()
{
document.getElementById('ImageButton1').src='yourotherimage.jpg';
}
Remember to add the script tag over the actual script
|
|
|
|
|
Hi Greg,
thank you for your help. I did it as explained, and actually seems to be a problem with the image path, it seems unable to find it. The image is in a regular folder named /Recursos/Iconos/, this folder is nested directly above the solution folder.
In C#, it works fine using the prefix "~" (~/Recursos/Iconos/imageclic.png), but i don't know if it must wok the same way inside a script (inside the .aspx tag).
(excuse my poor english)
|
|
|
|
|
alvarog01 wrote: In C#, it works fine using the prefix "~" (~/Recursos/Iconos/imageclic.png), but i don't know if it must wok the same way inside a script (inside the head .aspx tag).
You have to provide the relative path to it, or the weburl itself!
So you either do ../../Recursos/Iconos/imageclic.png (or as many ../ as you need),
or www.foobar.com/Recursos/Iconos/imageclic.png.
Forget about the "~" sign. Means nothing to javascript, far as i can tell
And if it does it's beyond me ;>
And don't worry, your English is fine.
var question = (_2b || !(_2b));
|
|
|
|