|
The feature that you are looking for is provided by Forms Authentication[^]. There are lots of information on web[^] regarding the same.
OR
You can do this yourself. Keep a session flag in your application. Set it to true/logged-in, once someone logins. Orelse keep it as false/not-logged-in. On any other page load, check the value of this session and move accordingly. If you find its value as false then do a hard Response.Redirect yourself in the code to login page.
|
|
|
|
|
Look at this
http://www.dotnetfunda.com/articles/article808-how-to-write-a-simple-login-page-in-aspnet-.aspx[^]
Now to extend this , you will need a Session variable that will carry the username of the Successful login and every page you must check if the Session is null , if its null redirect the user to the Login Page like this
if(Session["Usernane"] == null)
{
response.redirect("Login.aspx",false);
}
and when you are done with the session, meaning when the user logs out then you must abandon the session. or set it to null
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi,
I want to encapsulate the Data Access Layer in a class library project where the class library will contain LINQ to SQL classes and Business Logic Layer. For my ASP.NET Web application, I will add that class library reference so that the ASP.NET Web application just behave like the Presentation Layer. I am highly tempted to implement this architecture. But I just got one challenge. As the Data Access Layer will maintain the Connection String of the SQL database in Web.Config file, when I reference that class library DLL to my ASP.NET Web Application, how will the Web.Config file of that class library project get integrated to my web.config file of the presentation ASP.NET Web Application ?
At this moment, I am using ASP.NET 4.0 which has a cool feature : Web.Config.Debug, Web.Config.Release, so I can place the connection string of my production server website at Web.Config.Release. But, now, looks like, I will have to miss that feature as I am not sure how Web.Config (or App.Config) file will behave in my Data Access Layer class library project.
Would you please give me some idea ?
|
|
|
|
|
|
Hello,
Thanks for your reply. I understood how to read connection string from my DAL. But, the DAL class library will be compiled to a single DLL file which can be added as a reference to my Presentation Web Application, how can I import that config file to my Presentation Web Application where the Presentation Web Application already contains Web.Config file. Wont that conflict ? Moreover, when the DAL assembly is added to the Presentation layer Web App, will my DAL DLL know that what is the config file it must read from ?
|
|
|
|
|
Any assemblies used in your application will use the configuration file from the main executable, unless otherwise specified. Copy the settings necessary for your data access layer to the web.config file.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Quick one please lads. Is mono on Mac OS X an acceptable way to go with ASP.NET dev or should I just suck it up and use a Windows VM? Fairly simple ASP.NET here, nothing fancy.
|
|
|
|
|
Use a Windows VM.. It's the best way to go, as your webserver probably will be Windows Server..
"My personality is not represented by my hometown."
|
|
|
|
|
Thank you, that's what I'm going to do.
|
|
|
|
|
Hi to all,
Please Help me to solve my problem.
I have developed one web application.In that One Scan button is provided to scan Document through scanner. It works fine when I run Application on my local machine.
Now the Problem is I have uploaded my web Application on server. But When I am Pressing Scan Button, It is not responding. Why It is Happening I don't know. So Please Help Me To Solve My Problem
Thanks & Regards
Sanket
.
|
|
|
|
|
Unless the scanner was attached to your web server, it won't work. Think about it - how secure would your computer be if a web server could gain access to the devices attached to your PC and run them.
|
|
|
|
|
Guys, I am wondering if I could launch a javascript code just after an update panel load event.
100
Help people,so poeple can help you.
|
|
|
|
|
Hi,
Please try following:
Page.ClientScript.RegisterStartupScript(...)
Thanks,
Imdadhusen
sunaSaRa Imdadhusen
+91 99095 44184
+91 02767 284464
|
|
|
|
|
|
|
over my head, father of youth.
100
Help people,so poeple can help you.
|
|
|
|
|
Hi
I need to send a large number of emails as newsletter in website using SMTP protocol. The barrier is the server runs out of memory and raises an exception when emails count is large. I use a loop that iterates through an array of emails and send them. Is there any method that can mitigate this constriction. emails count is more than 100000.
|
|
|
|
|
I think you already have a response to this question here[^]. If you overload any system it may run out of memory; so the answer is either provide more memory, or implement some controls to slow down the process(es) that are consuming it.
I must get a clever new signature for 2011.
|
|
|
|
|
Hello Everybody,
I want to know that.
How can i change the theme of page in Button Click event.
Thanks
If you can think then I Can.
|
|
|
|
|
|
The Best approach is that create BasePage class under the app_code classes and inherit from Page class. Override Page_Preinit and change the theme here. After that Each webform should be inherited from basepage. I am assuming that you have themes under App_Theme Folder. code should be like this:-->
public class BasePage:System.Web.UI.Page
{
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
string selectedTheme="";
selectedTheme = ThemeManager.GetThemes()[0].Name; /*set top theme as default or from db according to user settings*/
if(!String.isNullorEmpty(selectedTheme))
Page.Theme = selectedTheme;
}
}
public class ThemeManager
{
public ThemeManager()
{
}
#region Theme-Related Method
public static List<Theme> GetThemes()
{
DirectoryInfo dInfo = new DirectoryInfo(System.Web.HttpContext.Current.Server.MapPath("~/App_Themes"));
DirectoryInfo[] dArrInfo = dInfo.GetDirectories();
List<Theme> list = new List<Theme>();
foreach (DirectoryInfo sDirectory in dArrInfo)
{
Theme temp = new Theme(sDirectory.Name);
list.Add(temp);
}
return list;
}
#endregion
}
|
|
|
|
|
|
How to sql query the next row of data if has null values?
If user will search a code in a textbox,
let say 1002, then the result on the
second textbox should 1003.
let say 1008, then the result on the
second textbox should 1009.
but if the search code is 1011 then
the second textbox has no result.
Goal is to get the first NULL values only.
TableName:tblCode
Code CodeName
1001 aaa
1002 bbb
1003 NULL
1004 NULL
1005 NULL
1006 NULL
1007 abc
1008 aac
1009 NULL
1010 bba
1011 cca
1012 aab
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
Select Top 1 Code
From tblCode
Where Code > @Code And CodeName Is Null
Order By Code
@Code = input from first text box
|
|
|
|
|
thanks a log s_magus,
i never think about select top. i always use MAX,MIN.
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|