|
|
I have set Session TimeOut=1440. But my application takes the default TimeOut.
Thanks in advance.
|
|
|
|
|
Quote: I have set Session TimeOut=1440
why such a huge time. MSDN article Session TimeOut[^] says, it should not be more than 20 minutes. Session is very crucial memory of the system. set the timeout for comparable time.
with regards
Karthik Harve
|
|
|
|
|
I have couple of things i want to mention in response to your question:
1. Do not set session timeout value to such a large interval. msdn recommends it to be around 20 minutes.
2. The session timeout value specifies the time ofter which the user session data will be flushed under normal conditions. if the server runs out of memory it will anyway start clearing the session objects.
3. If the ASP.NET application restarts the session values will be lost.
so in your case the session timeout must be happening mainly because of second reason and sometimes because of the third.
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
|
My ASP.net application uses a common class I added to my App_Code folder which has all of the methods I use more than once throughout the application.
Because this class is used in the masterpage, almost all site aspx pages and multiple usercontrols, I am instantiating the class multiple times in each request.
I am instantiating the class in the page_load of pages and controls and then setting it to nothing on each page_unload.
There is nothing in the class that needs to maintain state between requests.
Is there a better way to do this or is that the normal approach?
It seems so inefficient to me to be creating/destroying the class in every code behind file.
I was wondering if there would be any advantage to putting the class in each users session for re-use for the lifetime of the session.
I don't know if there would be any advantage to that approach or not.
i was thinking of checking (each time I instantiate) if the object is in session and if not add it and if its already in session, return the object.
I guess I could do that in the objects constructor.
Any suggestions much appreciated
Heres what I am doing in every code behind file now:
Dim c As New CommonCode()
Public ReadOnly Property C As CommonCode
Get
If C Is Nothing Then C = New CommonCode
Return C
End Get
End Property
Protected Sub btnPostComment_Click(sender As Object, e As EventArgs)
Dim name As String = IIf(txtName.Text = [String].Empty, "Anonymous", txtName.Text)
If txtComments.Text <> [String].Empty Then
c.PostComment(ID, name, txtComments.Text, RadRating.Value)
End If
End Sub
Protected Sub Page_Unload(sender As Object, e As System.EventArgs) Handles Me.Unload
c = Nothing
End Sub
|
|
|
|
|
IMHO, you need this class and the current approach is to create it in each page. which means you are acquiring some memory and taking some time to create the object.
If you keep the object in session then you will still be using than much of memory but the only advantage will be the overhead required in creating the object every-time will be gone.
1. But, in your current approach your object was being created on demand and if you keep this object in session that will like in user memory for all the time so I don't thing this is a good idea to save this in sessions.
2. Even with the overhead for creating object each time gone, you will still need the typecasting of session variables in each page which will effectively nullify the benefit we got.
3. putting this object will put some overload on session, which could mean that the session may be lost earlier than it should have(if number of request are more) and we will loose more valuable session info because we have this object residing in session memory.
My recommendation would be to keep it as you have implemented. Session should only be used for the crucial information. If you need to access this info frequently then perhaps you can think about storing it in Cache instead of Session . and if it can be reused across users keep it in Application variable.
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
Dear All,
In a DevExpress grid how to get the dropdown list value while saving the records.
Thanks,
Basit.
|
|
|
|
|
|
Hi,
I am using DevEpress textbox and I want to make validation expression for it.
I want the entry to be MINIMUM 10 digits no matter what is it, characters, numeric, special characters or mix BUT not SPACES
how can I make sure thing?
|
|
|
|
|
|
Hello,
plz help me i want to send email from asp.net web application in our godaddy server.
.......................
|
|
|
|
|
|
For GoDaddy, you need to use:
servername: relay-hosting.secureserver.net
port: 25
Thus, email code should be something like:
MailMessage msg = new MailMessage();
msg.From = new MailAddress("myEmail@abc.com","My Company");
msg.To.Add("toFriends@abc.com");
msg.Subject = "My Subject";
msg.Body = "My Message";
msg.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("relay-hosting.secureserver.net", 25);
smtp.Send(msg);
Try!
|
|
|
|
|
this code have some chinese,if you know
#region :Send Email
///
/// Send Email(Success return true, faile retuan false)
///
/// <param name="strBody" />content
/// <param name="strSubject" />theme
/// <param name="strFrom" />send email
/// <param name="strFromPwd" />send keys/param>
/// <param name="strTo" />get email
/// <returns>Success return true, faile retuan false
public static bool SendMail(string strBody, string strSubject, string strFrom, string strFromPwd, string strTo, string strSmtp)
{
bool b = false;
// 邮件信息(属性)
MailMessage mm = new MailMessage();
mm.From = new MailAddress(strFrom);
mm.Subject = strSubject;
mm.SubjectEncoding = Encoding.UTF8;
mm.Body = strBody;
mm.BodyEncoding = Encoding.UTF8;
mm.IsBodyHtml = true;
mm.Priority = MailPriority.Normal;
//// 获取 SMTP 服务器
//string Smtp = string.Empty; // smtp 地址
//// 取得后部分的 smtp地址
//string strSmtp = strFrom.Substring((strFrom.IndexOf("@") + 1));
//Smtp = "smtp." + strSmtp;
// 发送邮件
SmtpClient sc = new SmtpClient(strSmtp);
// 用户凭证 (email 地址和密码)
sc.Credentials = new NetworkCredential(strFrom, strFromPwd);
if (strSmtp == "gmail.com")
{
sc.EnableSsl = true;
}
sc.Timeout = 5000;
mm.To.Clear();
mm.To.Add(strTo);
try
{
sc.Send(mm);
b = true;
}
catch (ArgumentNullException ex)
{
b = false;
}
catch (SmtpException smtpEx)
{
b = false;
}
catch
{
b = false;
}
// 释放资源
mm.Dispose();
return b;
}
#endregion
|
|
|
|
|
Try this..I hope this what you want..Let us know if this doesn't solve your problem..
string strNoReplyEmail = "noreply@hotmail.com";
private void SendEMail(string strLastName, string strFirstName, string strEmail)
{
MailMessage objMail = new MailMessage(strNoReplyEmail, strEmail);
objMail.Subject = "Test Email";
objMail.Body = @"Dear " + strFirstName + " " + strLastName + ", \n\n"
+ "This is the test email. Please do not reply to this email."
+ " \n\n"
+ "Thank you,"
+ "\n"
+ "Administrator";
SmtpClient sc = new SmtpClient();
sc.Host = "www.hotmail.com";
sc.Send(objMail);
}
Dhyanga
|
|
|
|
|
Hi
I've been working the past three years with Java programming language, but recently for a master thesis project i would prefer to use a different language such as ASP.NET(C#) to extend my Knowledge.
I would like to know what kind of tools are available to build enterprise applications? in this case i will build a Portal with Human Resources Functionalities.
Im looking for something such as SmartClient (http://www.smartclient.com) or somethinng similar.
Can some expert give me advice on the available tools? the portal is planned to be used by a lot of users at the same time so i want to follow good pratices aswell.
Thanks for any help
|
|
|
|
|
|
Are you planning to build the application from scratch or just want to use a ready-to-use solution?
|
|
|
|
|
Hi thanks for the reply
I want to build the application from scratch. Mainly it will be a web portal where users can register and run human resources processes.
Will have a look at devexpress tools, thanks for the link
Thanks for any input
|
|
|
|
|
in fact! ASP.NET is not well with this.
and the php is better,you can try it
|
|
|
|
|
public partial class _Default : System.Web.UI.Page
{
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
grd_bind();
}
private void grd_bind()
{
SqlDataAdapter adp = new SqlDataAdapter("select * from tbdep; select * from tbemp7", ConfigurationManager.ConnectionStrings["cn"].ConnectionString);
adp.Fill(ds);
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
public DataSet getdata(Int32 dno)// public because we access it in HTML
{
string qry = "select * from tbemp7 where edno=" + dno.ToString();// we can't use it as performance low as it execute much a times
DataView dv;//to sort data, to filter data, to navigate data on dataset we use it
dv = ds.Tables[1].DefaultView;
dv.RowFilter = "edno=" + dno.ToString();
return dv;
}
}
IN HTML :
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Width="778px" BackColor="LightGoldenrodYellow" BorderColor="Tan"
BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None"
Height="281px">
<AlternatingRowStyle BackColor="PaleGoldenrod" />
<Columns>
<asp:TemplateField HeaderText="department">
<ItemTemplate>
<b>
dep no:</b><%#Eval("dno") %><br />
<b>dep name:</b><%#Eval("dname") %></ItemTemplate></asp:TemplateField>
<asp:TemplateField HeaderText="emp detail">
<ItemTemplate>
<asp:GridView ID="Gridview1" DataSource='<%#getdata(Convert.ToInt32(Eval("dno"))) %>' AutoGenerateColumns="false" Width="100px" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="EMPNO" DataField="empno" />
<asp:BoundField HeaderText="NAME" DataField="ename" />
<asp:BoundField HeaderText="ADDRESS" DataField="eadd" />
<asp:BoundField HeaderText="SALARY" DataField="esal" />
</Columns>
|
|
|
|
|
That's pretty bad programming:
1. You populate a dataset and assign it to grid in code behind file without IsPostback condition leading to data load on every postback
2. You again populate a dataset, use dataview to filter and assign again to another grid with same ID as previous one in aspx
3. You use wrong table index while assigning it to dataview.
4. You assign a number to datasource of inner grid instead of a view!
Try:
1. Make sure you have different names of the grids.
2. While fetching a table from database, only one table is returned for a select statement, so you use ds.Tables[0]
3. Look at this article on how to use Nested Grid:
MSDN: Walkthrough: Creating a Nested GridView Control[^]
Editable Nested GridView (All-in-One)[^]
|
|
|
|
|
I'm using a FormView that is bound to an ObjectDataSource. My ObjectDataSource is bound to a Linq2Sql table object. Update and delete are working fine. I'm having problems with insert. When I try and insert the DataItem that the FormView is bound to is null. How do I set the DataItem to a new entity object?
|
|
|
|
|
i tried to load pages from database and make numbers down the page loader but it does not work and it change the style of masterbage right side of master page show down the page loader
|
|
|
|