Ask a Question related to ASP.NET Security, Design and Development.
-
enahar #1
Thread was being aborted
Hi,
When I do the Login using the code below I am getting the
System.Thread.ThreadAbortException(Thread was being abortefd) on the last
line of the below code i.e.
Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent));
there is no original URL, therefore it is returning Default.aspx.
I don't know why I am getting the above exception.
private void ButtonLogin_Click(object sender, System.EventArgs e)
{
string sessionID = "";
string uID = txtUsername.Text;
string pwd = txtPassword.Text;
bool isPersistent = false; try
{
ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
sessionID);
string userData = sessionID;
switch(loginResult)
{
case ESMLoginResultEnum.OK:
{
FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new
HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
cookie.Path = FormsAuthentication.FormsCookiePath;
// Create the cookie.
Response.Cookies.Add(cookie);
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent));
break;
}
}
}
}
Regards,
Ekta
enahar Guest
-
Error: Thread was aborted from WaitForSingleObject
Hi, I've a WebApp that calls Microsoft CRM WebServices to perform a particular action. In my WebApp I am spawning a new async thread for all the... -
Newbie:Using ASP.NET thread pool thread to dispatch TCP data, etc.
Hi, I've an ASP.NET web service which distributes events to clients via TCP. Environment is IIS6 on Windows 2003 server with .NET framework 1.1... -
[PHP-DEV] Ifx - Help ! losing my mind, thread by thread
--------------010000080604040703060106 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, Please... -
DB2 Backup to TSM aborted
Hi guys and girls, DB2 stopped backing up to TSm recently after adding parallel writes to copy storage pools. the diag logs read: ... -
ThreadAbortException: Thread was aborted exception???
I've got a WebServices application that uses Crystal Reports to produce and then export Invoices to PDF format. Without getting into too many... -
Alessandro Zucchi #2
RE: Thread was being aborted
Hi,
I had the same problem and I resolved it in this way.
I modified the session as stateServer or Sql Server
or
I have turned off the antivirus on the directory InetPub anf for ASP_wp.exe
and aspnet_state.exe processes.
In fact , the antivirus, invalidate the session end the thread get aborted.
I hope to help you
By
"enahar" wrote:
> Hi,
>
> When I do the Login using the code below I am getting the
> System.Thread.ThreadAbortException(Thread was being abortefd) on the last
> line of the below code i.e.
> Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent));
>
> there is no original URL, therefore it is returning Default.aspx.
>
>
>
> I don't know why I am getting the above exception.
>
>
>
>
>
> private void ButtonLogin_Click(object sender, System.EventArgs e)
>
> {
>
> string sessionID = "";
>
> string uID = txtUsername.Text;
>
> string pwd = txtPassword.Text;
>
>
> bool isPersistent = false; try
>
> {
>
> ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
> sessionID);
>
> string userData = sessionID;
>
> switch(loginResult)
>
> {
>
> case ESMLoginResultEnum.OK:
>
> {
>
> FormsAuthenticationTicket ticket = new
> FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path);
>
> // Encrypt the ticket.
>
> string encTicket = FormsAuthentication.Encrypt(ticket);
>
> HttpCookie cookie = new
> HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
>
> cookie.Path = FormsAuthentication.FormsCookiePath;
>
> // Create the cookie.
>
> Response.Cookies.Add(cookie);
>
> // Redirect back to original URL.
>
> Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent));
>
>
>
> break;
>
> }
>
> }
>
> }
>
> }
>
>
>
> Regards,
>
> Ekta
>
>
>
>
>Alessandro Zucchi Guest
-
JayAchTee #3
RE: Thread was being aborted
The Redirect docs say:
Remarks
Redirect calls End which raises a ThreadAbortException exception upon
completion.
"enahar" wrote:
> Hi,
>
> When I do the Login using the code below I am getting the
> System.Thread.ThreadAbortException(Thread was being abortefd) on the last
> line of the below code i.e.
> Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent));
>
> there is no original URL, therefore it is returning Default.aspx.
>
>
>
> I don't know why I am getting the above exception.
>
>
>
>
>
> private void ButtonLogin_Click(object sender, System.EventArgs e)
>
> {
>
> string sessionID = "";
>
> string uID = txtUsername.Text;
>
> string pwd = txtPassword.Text;
>
>
> bool isPersistent = false; try
>
> {
>
> ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
> sessionID);
>
> string userData = sessionID;
>
> switch(loginResult)
>
> {
>
> case ESMLoginResultEnum.OK:
>
> {
>
> FormsAuthenticationTicket ticket = new
> FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path);
>
> // Encrypt the ticket.
>
> string encTicket = FormsAuthentication.Encrypt(ticket);
>
> HttpCookie cookie = new
> HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
>
> cookie.Path = FormsAuthentication.FormsCookiePath;
>
> // Create the cookie.
>
> Response.Cookies.Add(cookie);
>
> // Redirect back to original URL.
>
> Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent));
>
>
>
> break;
>
> }
>
> }
>
> }
>
> }
>
>
>
> Regards,
>
> Ekta
>
>
>
>
>JayAchTee Guest
-
enahar #4
Re: Thread was being aborted
Hi,
I am no more getting the exception of
System.Thread.ThreadAbortException(Thread was being abortefd) But still the
Session is still not timing out when there is no activity by the user for 15
minutes.What is wrong I am doing it.Please suggest.
I am writing the following code in the web.config file and the Login.aspx.cs
for the sessiopn TimeOut and for the forms authentication ticket timeout.
Also I am writing the following code in the Body tag of the Login.aspx page
<meta http-equiv="Refresh" URL="../Security/Login.aspx>
even then Session is still not timing out when there is no activity by the
user for 15 minutes.What is wrong I am doing it.Please suggest.
code in the session_end is as follows:
protected void Session_End(Object sender, EventArgs e)
{
FormsAuthentication.SignOut();
if (Session["SessionID"] != null)
{
try
{
ESMSecurityModule.killSession(Session["SessionID"].ToString());
}
catch
{
}
}
}
WEB.CONFIG
<authentication mode="Forms">
<forms loginUrl="../Security/Login.aspx" protection="All" timeout="15"
path="/" />
</authentication>
and for the forms authentication ticket TimeOut I am writing the following
code in the Login.aspx page:
LOGIN.ASPX PAGE
FormsAuthenticationTicket ticket = new
FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(15),false,userDat a,FormsAuthentication.FormsCookiePath);
// Encrypt the ticket.
string encTicket = FormsAuthentication.Encrypt(ticket);
HttpCookie cookie = new
HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
cookie.Path = FormsAuthentication.FormsCookiePath;
// Create the cookie.
Response.Cookies.Add(cookie);
// Redirect back to original URL.
Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent),false);
Regards,
Ekta
"Scott Allen" <scott@nospam.odetocode.com> wrote in message
news:l3vo21hihtmb3pauqj9sphjqorb7v225fk@4ax.com..."Alessandro Zucchi" <AlessandroZucchi@discussions.microsoft.com> wrote in> On Mon, 7 Mar 2005 17:09:01 +1100, "enahar" <enahar@hotmail.com>
> wrote:
>>>>Hi,
>>
>>Session is still not timing out when there is no activity by the user for
>>15
>>minutes.
>>
>>My web.config settings are as below.
>>also in the login page for the ticket I am adding 15 minutes.
>>
>>
>>What is wrong i am doing it..
>>
>>
>>Regards,
>>Ekta
>>
>>
> Hi Etka:
>
> Are you testing the Session timeout or the forms authentication ticket
> timeout?
>
> --
> Scott
> [url]http://www.OdeToCode.com/blogs/scott/[/url]
>
message news:18F57BBD-38D0-4EF1-8F55-D0BA6A4462E1@microsoft.com...> Hi,
> I had the same problem and I resolved it in this way.
> I modified the session as stateServer or Sql Server
> or
> I have turned off the antivirus on the directory InetPub anf for
> ASP_wp.exe
> and aspnet_state.exe processes.
> In fact , the antivirus, invalidate the session end the thread get
> aborted.
> I hope to help you
> By
>
> "enahar" wrote:
>>> Hi,
>>
>> When I do the Login using the code below I am getting the
>> System.Thread.ThreadAbortException(Thread was being abortefd) on the last
>> line of the below code i.e.
>> Response.RedirectFormsAuthentication.GetRedirectUr luID,isPersistent));
>>
>> there is no original URL, therefore it is returning Default.aspx.
>>
>>
>>
>> I don't know why I am getting the above exception.
>>
>>
>>
>>
>>
>> private void ButtonLogin_Click(object sender, System.EventArgs e)
>>
>> {
>>
>> string sessionID = "";
>>
>> string uID = txtUsername.Text;
>>
>> string pwd = txtPassword.Text;
>>
>>
>> bool isPersistent = false; try
>>
>> {
>>
>> ESMLoginResultEnum loginResult = ESMSecurityModule.Login(uID, pwd, out
>> sessionID);
>>
>> string userData = sessionID;
>>
>> switch(loginResult)
>>
>> {
>>
>> case ESMLoginResultEnum.OK:
>>
>> {
>>
>> FormsAuthenticationTicket ticket = new
>> FormsAuthenticationTicket(1,uID,System.DateTime.No w,System.DateTime.Now.AddMinutes(AUTH_TIMEOUT),isP ersistent,userData,FormsAuthentication.FormsCookie Path);
>>
>> // Encrypt the ticket.
>>
>> string encTicket = FormsAuthentication.Encrypt(ticket);
>>
>> HttpCookie cookie = new
>> HttpCookie(FormsAuthentication.FormsCookieName,enc Ticket);
>>
>> cookie.Path = FormsAuthentication.FormsCookiePath;
>>
>> // Create the cookie.
>>
>> Response.Cookies.Add(cookie);
>>
>> // Redirect back to original URL.
>>
>> Response.Redirect(FormsAuthentication.GetRedirectU rl(uID,isPersistent));
>>
>>
>>
>> break;
>>
>> }
>>
>> }
>>
>> }
>>
>> }
>>
>>
>>
>> Regards,
>>
>> Ekta
>>
>>
>>
>>
>>
enahar Guest



Reply With Quote

