Click here to Skip to main content
15,915,093 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: how i can download data from advertise job offers website Pin
N a v a n e e t h2-Jul-08 17:28
N a v a n e e t h2-Jul-08 17:28 
QuestionHow to read selected value of radiobuttionlist control Pin
Rameez Raja2-Jul-08 16:34
Rameez Raja2-Jul-08 16:34 
AnswerRe: How to read selected value of radiobuttionlist control Pin
Gayani Devapriya2-Jul-08 18:10
Gayani Devapriya2-Jul-08 18:10 
GeneralRe: How to read selected value of radiobuttionlist control Pin
Rameez Raja2-Jul-08 20:14
Rameez Raja2-Jul-08 20:14 
QuestionCrystal Report Pin
sabaMCA2-Jul-08 12:45
sabaMCA2-Jul-08 12:45 
AnswerRe: Crystal Report Pin
Paul Conrad2-Jul-08 18:35
professionalPaul Conrad2-Jul-08 18:35 
AnswerRe: Crystal Report Pin
BalasubramanianK2-Jul-08 19:37
BalasubramanianK2-Jul-08 19:37 
QuestionHow to redirect to login page when cache item expired Pin
javidot2-Jul-08 12:33
javidot2-Jul-08 12:33 
Hi,

I have a code in the login.aspx.vb that create a cache item with the information of the user.
When the cache item expired it make a CallBack. In the callback I want to sign out and
redirect to the login page. When it tries to redirect, I received an "Object reference not set
to an instance of an object." error because the System.Web.HttpContext.Current = nothing.

Here is the code in the login page code behind:

Private Sub MyCacheItemRemovedCallback(ByVal key As String, ByVal val As Object, ByVal reason As Caching.CacheItemRemovedReason)
If reason = Caching.CacheItemRemovedReason.Expired Then
Try
System.Web.HttpContext.Current.Response.Redirect("SignOut.aspx")
Catch ex As Exception
End Try
End If
End Sub

Private Function AlreadyLogin() As Boolean
Dim sKey As String = TextBox_Login.Text.Trim + TextBox_Password.Text.Trim
Dim sUser As String = Cache(sKey)
If (sUser = Nothing) Or (sUser = "") Then
Dim callBack As Caching.CacheItemRemovedCallback = New Caching.CacheItemRemovedCallback(AddressOf MyCacheItemRemovedCallback)
Dim SessTimeOut As TimeSpan = New TimeSpan(0, 0, 15, , 0)
HttpContext.Current.Cache.Insert(sKey, sKey, Nothing, DateTime.MaxValue, SessTimeOut, System.Web.Caching.CacheItemPriority.NotRemovable, callBack)
Session("CurrentUser") = TextBox_Login.Text.Trim + TextBox_Password.Text.Trim
Return False
Else
Label_ErrorMessage.Text = Constants.ERROR_LOGIN_USER_LOGGED_IN
Return True
End If
End Function



Thank you for your responses
AnswerRe: How to redirect to login page when cache item expired Pin
AlexeiXX32-Jul-08 16:24
AlexeiXX32-Jul-08 16:24 
GeneralRe: How to redirect to login page when cache item expired Pin
javidot3-Jul-08 4:17
javidot3-Jul-08 4:17 
GeneralRe: How to redirect to login page when cache item expired Pin
AlexeiXX33-Jul-08 17:27
AlexeiXX33-Jul-08 17:27 
QuestionSave an MS-Excel Pin
Assaf822-Jul-08 11:20
Assaf822-Jul-08 11:20 
QuestionVisual Studio 2008 and FormView Pin
Jacob Dixon2-Jul-08 10:12
Jacob Dixon2-Jul-08 10:12 
AnswerRe: Visual Studio 2008 and FormView Pin
AlexeiXX32-Jul-08 13:50
AlexeiXX32-Jul-08 13:50 
GeneralRe: Visual Studio 2008 and FormView Pin
Jacob Dixon2-Jul-08 15:55
Jacob Dixon2-Jul-08 15:55 
GeneralRe: Visual Studio 2008 and FormView Pin
AlexeiXX32-Jul-08 16:20
AlexeiXX32-Jul-08 16:20 
GeneralRe: Visual Studio 2008 and FormView Pin
Jacob Dixon3-Jul-08 7:20
Jacob Dixon3-Jul-08 7:20 
QuestionRunning an independent C# class along with asp.net website Pin
zomoo2-Jul-08 9:10
zomoo2-Jul-08 9:10 
AnswerRe: Running an independent C# class along with asp.net website Pin
Gayani Devapriya2-Jul-08 18:17
Gayani Devapriya2-Jul-08 18:17 
QuestionMethods being added to web page, not codebehind. Pin
Richard Jones2-Jul-08 7:37
Richard Jones2-Jul-08 7:37 
GeneralRe: Methods being added to web page, not codebehind. Pin
tina->newcoder2-Jul-08 8:03
tina->newcoder2-Jul-08 8:03 
GeneralRe: Methods being added to web page, not codebehind. Pin
Richard Jones2-Jul-08 9:01
Richard Jones2-Jul-08 9:01 
GeneralRe: Methods being added to web page, not codebehind. Pin
AlexeiXX32-Jul-08 13:53
AlexeiXX32-Jul-08 13:53 
GeneralRe: Methods being added to web page, not codebehind. Pin
Richard Jones3-Jul-08 2:48
Richard Jones3-Jul-08 2:48 
GeneralRe: Methods being added to web page, not codebehind. Pin
AlexeiXX33-Jul-08 3:56
AlexeiXX33-Jul-08 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.