|
|
Hi
how to know session is expired or not.If session is expired then
i want to redirect the user to login page.How can i do this.Please
guide me.
Rahul
|
|
|
|
|
First method
if ( Session["UserId"] == null )
Response.Redirect("Login.aspx");
Second Method
try
{
string UserId = Session["UserId"].ToString();
}
catch(Exception Ex)
{
Response.Redirect("Login.aspx");
}
|
|
|
|
|
Hi Navaneeth
but i have to define somewhere session("userid") somewhere
before writing it on every page. i.e i have to define
on session start event session("userid") or just i have to
write the code on my page.
Rahul
|
|
|
|
|
Obviously, he's assuming you've stored a userId in the session when the user logged in. That is really the most obvious way to keep track of login, and your site obviously supports logging in.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yes i have keep userid in session when user login.On each and every page
i have to check session("userid")=="" if its null then its redirecting
to login page after 20 min.
df
|
|
|
|
|
Hi,
The way u need to check whether session is null or not is like below...
rahul.net11 wrote: session("userid")==""
if ( Session["UserId"] == null )
Regards,
Sandeep Kumar.V
|
|
|
|
|
If you didn't want to do it on each and every page, you can create a base page which all of your web pages inherit from and just do it in the base page. That is what I have done.
Ben
|
|
|
|
|
rahul.net11 wrote: i have to define
on session start event session("userid") or just i have to
write the code on my page.
Exactly what Christian Graus said
|
|
|
|
|
Thanks
I tried it it working.
Rahul
|
|
|
|
|
Thanks
I tried it its working.One more query i have
define 10 values in different session and when session get expired
then values in my all session gets null or some session values still
remain in session.Because i am sending user to login page i force
user to enter only its password because i am taking its email id on
first page and putting it in session and then checking its password
using its mail id.If values in session (email) is get expired or not?
Rahul
|
|
|
|
|
When session ends all your session values will be cleared. If you don't want user to reenter email id, you need to store it in some cookies
|
|
|
|
|
Ok Thanks for your help.
Rahul
|
|
|
|
|
i have to populate data table's values in combo box control using c#.net 2.0. so please provide some code for it
|
|
|
|
|
myCombo.DataSource = myTable;
myCombo.DataBind();
Your combo has properties you can set for which column value to use for display and for the value member.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
HI
i am tryin to bind a image file name to an imageurl tag that is stored in a datagrid
But i keep getting the error message: the server tag is not well formed,
how would i alter this so its correct?
<asp:TemplateColumn HeaderText=Products >
<ItemTemplate ><asp:Image runat=server ID=imageHolder imageurl="~/test/<%#databinder.eval(container.dataitem,"imageAddress"))%> " />
</ItemTemplate>
</asp:TemplateColumn>
Any help greatly appreciated
Cheers
boyindie
|
|
|
|
|
<asp:TemplateColumn HeaderText=Products >
<ItemTemplate >
<asp:Image runat="server" ID="imageHolder" imageurl="~/test/<%# Databinder.Eval(Container("DataItem.imageAddress"))%> " />
</ItemTemplate>
</asp:TemplateColumn>
|
|
|
|
|
i ahve done the above but it jus displays the red cross in the box i checked the source and it has filled the correct paths in the image urls
any ideas?
|
|
|
|
|
hi,
I m neha gupta.i m making a project online book store ..In this project there is a cart facilities i.e. data grid control..
How can i delete any items from data grid...
thanks
neha
Neha gupta
|
|
|
|
|
You want to remove them from your data source ? The most likely way is to use a button which, when clicked, removes the item.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
I pass the name of the stored procedure into my function and then append the parameters the stored procedure expects.
This works fine as long as I have stored procedures which expect always the same parameters.
But now there are very few exceptions. So my question is if there is a way to check how many parameters a stored procedure is expecting before I execute it?
Public Function GetReport(ByVal StoredProc As String) As Boolean
Dim cmd As New SqlCommand(StoredProc, m_Conn)
cmd.Parameters.Add(...)
cmd.Parameters.Add(...)
Many thanks for all kind of hints
Andreas
|
|
|
|
|
You can pass a Dictionary, where the keys are the parameter names and the values are the parameters. Otherwise, no. You can't ask how many are expected, and if you're calling a proc, you really need to know ( who cares how many it expects if you don't have values to pass through to it ? )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That's true
Thanks
|
|
|
|
|
Hi All
I want to add richedit or richtext control in my asp.net form plz tell me how could i do it i am unable to add it
|
|
|
|