Showing posts with label password. Show all posts
Showing posts with label password. Show all posts

Monday, March 26, 2012

Newbie ? - Error on Redirect from login page error

Hello all,
Trying to make a login page to a website. However I don't the user to be
able to set a password, I want to control the password for everbody, and
change it wly. Any way, I have found alot of docs on Form Authentication
to be used as a login page. But they all are a little diffrent, and always
cover the highlights. I would love to see something that takes me from poin
t
A to Point B. Anyway's, I have been making some progress, although slower
than I would like. So here is a snippet of my code for my login button.
Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogIn.Click
' Server.Transfer("main.aspx") used to go to main page
Session("User Name") = txtUN.Text
Session("Password") = txtPW.Text
FormsAuthentication.RedirectFromLoginPage(txtUN.Text, False)
End Sub
And here is my web config code
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<location path="ProtectMe.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
<system.web>
<httpHandlers>
<add verb="*" path="Users.xml"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers>
<authentication mode="Forms">
<forms name="ImsApp"
loginUrl="localhost/mmgims/Login1.aspx" protection="all"/>
</forms>
</authentication>
</system.web>
</configuration>
It is my understanding that the redirectfromloginpage should take me to the
login page if the password or User name is wrong. But this is what I get for
an error
Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.
Requested Url: /mmgims/default.aspx
I don't have a default page, I have the login page, and the main page which
would be my home page. Again, I been taking a little bit of info from
everywhaere.
Any advise would be great!!!
Thanks to all!!!
RudyI think your problem is the loginUrl in your web.config.
Make this path relative to the web.config
so your web.config is under the root, and your login page is under
mmgims directory make it this:
loginUrl="mmgims/Login1.aspx"
leave the localhost part out of there. your page is redirecting how it
should, but it can't find the login page you specified.
let me know if that works.
DKode
Thanks for the tip, that does make sense! I'll try it out tonite and let you
know.
Rudy
"DKode" wrote:

> I think your problem is the loginUrl in your web.config.
> Make this path relative to the web.config
> so your web.config is under the root, and your login page is under
> mmgims directory make it this:
> loginUrl="mmgims/Login1.aspx"
> leave the localhost part out of there. your page is redirecting how it
> should, but it can't find the login page you specified.
> let me know if that works.
> DKode
>
thanks DKode, that did the trick!
"Rudy" wrote:
> Thanks for the tip, that does make sense! I'll try it out tonite and let y
ou
> know.
> Rudy
> "DKode" wrote:
>

Newbie ? - Error on Redirect from login page error

Hello all,

Trying to make a login page to a website. However I don't the user to be
able to set a password, I want to control the password for everbody, and
change it weekly. Any way, I have found alot of docs on Form Authentication
to be used as a login page. But they all are a little diffrent, and always
cover the highlights. I would love to see something that takes me from point
A to Point B. Anyway's, I have been making some progress, although slower
than I would like. So here is a snippet of my code for my login button.
Private Sub btnLogIn_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnLogIn.Click
' Server.Transfer("main.aspx") used to go to main page
Session("User Name") = txtUN.Text
Session("Password") = txtPW.Text

FormsAuthentication.RedirectFromLoginPage(txtUN.Te xt, False)
End Sub

And here is my web config code
<?xml version="1.0" encoding="utf-8" ?>
<configuration
<location path="ProtectMe.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location
<system.web
<httpHandlers>
<add verb="*" path="Users.xml"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers
<authentication mode="Forms">
<forms name="ImsApp"
loginUrl="localhost/mmgims/Login1.aspx" protection="all"/
</forms>
</authentication
</system.web>
</configuration>
It is my understanding that the redirectfromloginpage should take me to the
login page if the password or User name is wrong. But this is what I get for
an error

Description: HTTP 404. The resource you are looking for (or one of its
dependencies) could have been removed, had its name changed, or is
temporarily unavailable. Please review the following URL and make sure that
it is spelled correctly.

Requested Url: /mmgims/default.aspx

I don't have a default page, I have the login page, and the main page which
would be my home page. Again, I been taking a little bit of info from
everywhaere.

Any advise would be great!!!

Thanks to all!!!

RudyI think your problem is the loginUrl in your web.config.

Make this path relative to the web.config

so your web.config is under the root, and your login page is under
mmgims directory make it this:

loginUrl="mmgims/Login1.aspx"

leave the localhost part out of there. your page is redirecting how it
should, but it can't find the login page you specified.
let me know if that works.

DKode
Thanks for the tip, that does make sense! I'll try it out tonite and let you
know.

Rudy

"DKode" wrote:

> I think your problem is the loginUrl in your web.config.
> Make this path relative to the web.config
> so your web.config is under the root, and your login page is under
> mmgims directory make it this:
> loginUrl="mmgims/Login1.aspx"
> leave the localhost part out of there. your page is redirecting how it
> should, but it can't find the login page you specified.
> let me know if that works.
> DKode
>
thanks DKode, that did the trick!

"Rudy" wrote:

> Thanks for the tip, that does make sense! I'll try it out tonite and let you
> know.
> Rudy
> "DKode" wrote:
> > I think your problem is the loginUrl in your web.config.
> > Make this path relative to the web.config
> > so your web.config is under the root, and your login page is under
> > mmgims directory make it this:
> > loginUrl="mmgims/Login1.aspx"
> > leave the localhost part out of there. your page is redirecting how it
> > should, but it can't find the login page you specified.
> > let me know if that works.
> > DKode

Saturday, March 24, 2012

Newbie encryption question

I am going to use Symmetric key encryption and decryption using Rijndael algorithm when registering a new user's password as well as logging some into the application. Is the following the proper process? When the submit button is clicked, pass the value of the password textbox into a variable and encrypt. Then when I get to the point of matching the password against a database to decrypt to plain text and pass it into my stored procedure? Hope this makes sense. Thanks.How are you going to use symmetric key encryption? The user has to send you a key to do that.

What I think you want to do is hash the password. Take a look at the code here:

http://davidhayden.com/blog/dave/archive/2004/02/16/157.aspx
If I use SSL, do I still need to hash the password?
Yes, you will have to hash the password. Keep in mind that SSL just protects the communication between the browser and the server. When you store the password into the database, it will be seen as a normal cleartext password.

Friday, March 16, 2012

Newbie needing a little help getting started

I need to make a redirect page that will pass over an id and password to a diffrent site (universal login)
Well my company already has 2 of them (which i did not make either of them) and now I am being thrust into making them (and i barely know asp.net)
My boss told me where to get the files but when i try to open them it gives me an error saying "Unable to get project from web server"
I am trying to open the old .net files so i can see how they were made so i can pretty much use the same code just tell it to go to a diffrent page
Can anyone help me open the files or maybe point me in the right direction on how to make my own universal logins?
Well, the question is not clear.
You said you opened the old .net files, couldn;t you understand what was going on? Redirecting to another page on another server?
regards

If you can't open the files on the web server, have you tried copying the project over to your computer and opening it locally in visual studio.net?
smtraber
Here is the thing...
My boss made it on his pc, he put the project up in a folder that I have access to on our network.
I pulled it down and now i can not open it.
My question is how to open the project.
and i also have another question, which is can someone point me in the direction on how to make universal links.

smtraber wrote:

If you can't open the files on the web server, have you tried copying the project over to your computer and opening it locally in visual studio.net?
smtraber


yes i have tried copying the file to my own pc, but it still is not working.
i really need to get this file open. Everything i try it keeps saying " Unable to get project from the web serever "


I'm not sure if this will solve your problem, but I read somewhere this can be solved if you:
1. Delete the project file from your LOCAL computer and remove the virtual directory
2. Create a new ASP.net web project in visual studio, which will also create a new virtual directory
3. Copy the files in the project from your web server over to the project folder you just created in inetpub, then try to open them
Hope this helps,
smtraber

NEWBIE NEEDS HELP - pull value from sql table

I have searched this forum and can't find the answer to my question. I have a login page that validates username/password. I am validating that the username is in the sql table, but I would also like to return the rest of the information for that user to pass in a querystring. For example, the user ID . I have setup my sql string to select username, password, Name, and email. How do I pull the id from this dataset?


userDataset = myUserVAlidation(enterUsername, enterPassword)
If userDataset.tables(0).rows.count = 1 then
'found record in database table
ENd if

Function myUserValidation(ByVal username as string, byVal password as string)
Dim connectionString as ...
Dim sqlConn as system.data.sqlclient.sqlconnection = new system.data.sqlClient.sqlconnection(connectionSTring)
Dim sqlString as string = "Select [userTable][username], [userTable][password], [userTable][fullName], [userTable][id] where (([userTable].[username] = @dotnet.itags.org.username) and ([userTable].[password] = @dotnet.itags.org.password))"

Dim sqlCommand as system.data.sqlclient.sqlcommand = new system.data.sqlclient.sqlCommand(sqlString, sqlConn)

sqlCommand.parameters.add("@dotnet.itags.org.username", system.data.sqldbtype.varchar).value = username
sqlCommand.parameters.add("@dotnet.itags.org.password", system.data.sqldbtype.varchar).value = password

dim dataAdapter as system.data.sqlclient.sqldataadapter = new system.data.sqlclient.sqldataadapter(sqlCommand)
dim dataset as system.data.dataset = new system.data.dataset
dataadapter.fill(dataset)
return dataset

end function

To get the id you could use the following:
string id = userDataset.Tables[0].Rows[0].ItemArray.GetValue(3)
The index for GetValue = 3 because id is the 4th column returned from your sql statement.