|
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);
|
|
|
|
|
|
But, be aware that if you do set the value to false, the page you are currently on will continue to process. If the value is true (the default) then the page stops processing immediately.
See also the answer I gave here[^]
Man who stand on hill with mouth open wait long time for roast duck to drop in
|
|
|
|