|
I want to create my own Users / admin tables with various information, and most to all articles, including both asp.net books I read all revolve around MSSQL Web Site Administration Tool, which for some reason or another I find to restrictive for my purposes.
I want to know pretty much, based on I have a registration script working, how to make a login which uses my own tables in my database. My login stored procedure compares a username and a hashed password and returns a count, 0 being obviously an inexistent or invalid combination.
So how would I go about making a login script and creating a session? If you choose to post snippets of code, VB.NET and C# is what I am capable of understanding, I'm using VS2008 and MSSQL 2005.
Just for a side question, none of the articles where all to helpful or descriptive on restricting sections of a website (or in my case, whole directories) to certain usergroups. Any detailed explanation or even pointing me to a website would be great. I don't want full code, and this is absolutely not urgent, I'm capable of waiting for an answer as there are other things to be done while waiting on this. If you took a look at all this, thanks in advance. I tried to be as descriptive as possible.
|
|
|
|
|
EliottA wrote: So how would I go about making a login script and creating a session?
I am not sure that I got your question correctly. Are you asking how to validate the user login and create a session for user? If yes, that sounds pretty trivial.
You have to classify the types of users and restriction levels required in your website. Assuming you have two kinds of users, a normal user and administrators. Create a class that derives from System.Web.UI.Page , say WebPage . Since you have two types of restriction levels, create two classes NormalUserPage and AdminPage both derived from WebPage and contains security checking for each type.
If a page in your website has normal user access rights, derive the page from NormalUserPage . If it requires administrator rights, derive from AdminPage . This method helps you to add/remove certain user types with minimal code change.
Is that what you are looking for?
|
|
|
|
|
Thanks for the help, yes that's pretty much what I was looking for description wise. But how to create a session and keep track of it is more of what I was looking for, also while using the Web.config to restrict users from areas of the site based off their permission or role.
N a v a n e e t h wrote: If yes, that sounds pretty trivial. That's because I'm a beginner, stuck on a trivial part
|
|
|
|
|
|
Hey friends! I m a regular viewer of CODEPROJECT. I m designing an application for a software firm. In Login form , during (Response.redirect) an error is encounterd saying that"Threat was being aborted."
I tried
"server.transfer(url,false)"
"response.redirect(url,false)"
but it does not redirect to the target link instead it stays back to the current page.please help me out.
THanks in advance.
modified on Monday, May 11, 2009 8:57 AM
|
|
|
|
|
The ThreadAbortException is normal for a page redirect. It isn't an error.
If you are catching exceptions, you must allow this one through.
try
{
}
catch(ThreadAbortException)
{
throw;
}
catch(Exception ex)
{
}
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Colin Angus Mackay wrote: throw; // Continue throwing the ThreadAbortException
I think this is not required as ThreadAbortException will be raised again automatically at the end of catch block.
|
|
|
|
|
N a v a n e e t h wrote: I think this is not required as ThreadAbortException will be raised again automatically at the end of catch block.
Really? Anyway, if you are catching other exceptions where the scope includes ThreadAbortException, you don't want to be processing stuff unnecessarily.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
Colin Angus Mackay wrote: Really?
Yup. Quoting MSDN,
ThreadAbortException is a special exception that can be caught, but it will automatically be raised again at the end of the catch block. When this exception is raised, the runtime executes all the finally blocks before ending the thread.
|
|
|
|
|
thanks, but it's not working.
|
|
|
|
|
priya1515s wrote: but it's not working.
Define "not working" - I'm not a mind reader.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
priya1515s wrote: but it does not redirect to the target link instead it stays back to the current page.please help me out.
It may be possible that you are catching and suppressing this exception, thus not allowing it to continue up to the top to allow ASP.NET to handle it.
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|
|
"not working" meaning that the same problem occurs again.the page is not redirecting and stays back.
|
|
|
|
|
show us the piece of code. What is the value of url ?
|
|
|
|
|
Redirect internally calls Response.End which calls Abort function that raises ThreadAbortException exception upon completion. Plz post your stacktrace and code.
|
|
|
|
|
Hi,
I have a gridview and I have used Footer template to insert data. When there is no data returned from select method of object datasource The empty data text is displayed and nothing displays. I want that when there is no data then atleast the footer templates should be displayed so that new record can be inserted. How can i do this.
Please help...
|
|
|
|
|
Retrieve your data in a dataset begore databinding it to a gridview. Add a newrow() to you dataset if it has 0 rows:
i.e.:
myTable.Rows.Add(myTable.NewRow());
Your Gridview wil display an empty gridview row but also the footerrow.
In Word you can only store 2 bytes. That is why I use Writer.
|
|
|
|
|
Hi i am new to Crystal report. I search google example and create a Report. But at execution it ask Login information each time. I had a VB code for solution.
Dim ConnInfo As New ConnectionInfo
With ConnInfo
.ServerName = ".sqlexpress"
.DatabaseName = "Northwind"
.UserID = "sa"
.Password = "eXpress2005"
End With
For Each cnInfo As TableLogOnInfo In Me.CrystalReportViewer1.LogOnInfo
cnInfo.ConnectionInfo = ConnInfo
Next
End Sub
Can anyone tell the C# code to achieve this?
|
|
|
|
|
HI Karthik,
You can use this code for refrence to display crystal report.
sql= "";
DataSet ds = new DataSet();
OleDbDataAdapter AdpNew = new OleDbDataAdapter(sql,Conn);
AdpNew.Fill(ds);
Rpt ReportObject = new Rpt();
ReportObject.SetDataSource(ObjectName.Tables[0]);
ReportViewerName.Height = this.Height;
ReportViewerName.Width = this.Width;
ReportViewerName.ReportSource = ReportObject;
|
|
|
|
|
Need to change the date format in javascript.
format is dd/MM/yyyy
|
|
|
|
|
|
javascript does not have build-in date formatting. But, many people have wrote small js code to format date to various degree. Simple Google[^] search turns a wealth of examples.
|
|
|
|
|
Hi,
I am beginner in asp.net and my problem When i try to redirect with the code
Response.Redirect("~/Zone/Home.aspx?ZID=24&"); an exception is being raised i.e;
"Thread is being aborted" and after this redirection is done without any problems. What cud be the possible mistake made by me?
Plz help.
|
|
|
|
|
If you look at the Redirect[^] documentation, you will see it takes a second parameter of a type of bool to indicate if you want to terminate current page execution
use instead
Response.Redirect("~/Zone/Home.aspx?ZID=24&", false);
|
|
|
|
|