473,750 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Login Securiuty

I have a .NET login page that works fine locally but when
I upload to my web host provider the login page keeps
reappearing. When I click the login button, the login
page reappears asking to login again.

Here's the code behind my login_Click button:

clsSecurity oSec = new clsSecurity();
oSec.sUserName = txtUserName.Tex t;
oSec.sPassword = txtPassword.Tex t;
if (oSec.ValidUser () == true)
{
Session["UserID"] = oSec.iUserID.To String();
Session["UserName"] = oSec.sUserName. ToString();
FormsAuthentica tionTicket tkt;
string cookiestr;
HttpCookie ck;
tkt = new FormsAuthentica tionTicket(1,tx tUserName.Text,
DateTime.Now, DateTime.Now.Ad dMinutes(30), false, "your
custom data",FormsAuth entication.Form sCookiePath);
cookiestr = FormsAuthentica tion.Encrypt(tk t);
ck = new HttpCookie(Form sAuthentication .FormsCookieNam e,
cookiestr);
ck.Expires=tkt. Expiration;
Response.Cookie s.Add(ck);
string strRedirect;
lblMessage.Text = "UserID=" + Convert.ToStrin g(Session
["UserID"]);
strRedirect = Request["ReturnUrl"];
if (strRedirect==n ull){
strRedirect = "Default.as px";
Response.Redire ct(strRedirect, true);
}
else
lblMessage.Text = "Invalid User Account.";
Jul 19 '05 #1
1 1642
Hello,

Thanks for your post. I'd like to share the following information with you:

1. I did not find any obvious problem in your code. I recommend you debug
the page and check the following line especially:

a. if (oSec.ValidUser () == true)?
b. if (strRedirect==n ull)?

Please refer to the following MSDN article on "ASP Remote Debugging Setup"
http://msdn.microsoft.com/library/de...us/vsdebug/htm
l/vxtskaspremoted ebuggingsetup.a sp

2. The KB article 301240 provides the same funcationality, please refer to
it or you may even follow its steps and see if it works on your side.
HOW TO: Implement Forms-Based Authentication in Your ASP.NET Application by
Using C# .NET
http://support.microsoft.com/?id=301240

Please feel free to let me know if you have any problems or concerns.

Have a nice day!

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! ¨C www.microsoft.com/security
This posting is provided ¡°as is¡± with no warranties and confers no rights.
Jul 19 '05 #2

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

Similar topics

3
2879
by: koolyio | last post by:
Hey, could you please tell me what is wrong with my login script. I just started learning php. CODE: login.php <? session_start(); header("Cache-Control: private"); ?>
5
2969
by: Simon | last post by:
Hi, I have a Login.php page that logs the user in and out. I has two forms within the page, (depending on what we are trying to do), either one to log in or out. The form calls itself using a post method and either logs the user in our out given the information from the form. but every pages use sessions and cookies, if the user is successfully logged in then the cookies and session values are updated, (as well as MySQL).
1
7915
by: Tom Jones | last post by:
Hi, I am using the HttpWebRequest and HttpWebResponse classes to pull information from a web server on the internet. I have an account on one of the webservers that I need to log into programatically. The connection is not secure (not https, etc.). The login page just has simple name & password textboxes on it. Can someone please tell me how I can programatically login using the
2
2783
by: Beginner | last post by:
I know this is an old question, but searching all over the internet plus several MS security conferences, still haven't got a straight anwser. Basically, the login.aspx is on one dedicated server in the domain using AD. ASP.NET applications run on other servers (not neccessary in domain) and trying to use authentication server. How could this be done? - Most response says you need to set MachineKey the same, but that alone doesn't...
4
2826
by: nicholas | last post by:
Hi, Got an asp.net application and I use the "forms" authentication mode defined in the web.config file. Everything works fine. But now I would like to add a second, different login page for the users that go in a specific folder. How can I do this?
1
267
by: Rayc | last post by:
I have a .NET login page that works fine locally but when I upload to my web host provider the login page keeps reappearing. When I click the login button, the login page reappears asking to login again. Here's the code behind my login_Click button: clsSecurity oSec = new clsSecurity(); oSec.sUserName = txtUserName.Text; oSec.sPassword = txtPassword.Text;
2
4513
by: IdleBrain | last post by:
Hello All: I used a Login control to authenticate a user to login. The problem is that when I login with good username & password, the login view would say that the login was successful. But for some reason the login control does not redirect the control to DestinationPageUrl. Even when I hardcoded to redirect to another page, it still remains in the same page on successful login.
6
3358
by: AppleBag | last post by:
I'm having the worst time trying to login to myspace through code. Can someone tell me how to do this? Please try it yourself before replying, only because I have asked this a couple of times in the past in other places, and while the help was much appreciated, it seemed everyone just wanted to 'theoretically' explain how to do it, but when I tried to do it myself, I couldn't login. I want to simply pass the email address and password to...
13
4173
by: Apostle | last post by:
Hi all, after thinking for sometimes, I thought it will be great opportunity to learn if I will start from scratch and build my own register/login system. Here is the thread that I will be posting the progress and I hope you guys will help me. The code below is what I have so far. Just put two scripts in the same directory and that is! I hope you will help me Thanks! class.php <?php //php login sytem class LoginRegister{ function...
0
8836
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
9575
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
9394
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...
1
9338
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6803
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6080
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
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2798
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.