Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ÔÚasp.net webserviceÖÐÈçºÎʹÓÃsession

ÔÚʹÓÃasp.net±àдwebserviceʱ£¬Ä¬ÈÏÇé¿öÏÂÊDz»Ö§³ÖsessionµÄ£¬µ«ÎÒÃÇ¿ÉÒÔ°ÑWebMethodµÄEnableSessionÑ¡ÏîÉèΪtrueÀ´ÏÔʽµÄ´ò¿ªËü£¬Çë¿´ÒÔÏÂÀý×Ó£º
1 н¨ÍøÕ¾WebSite 
2 н¨web·þÎñWebService.asmx£¬Ëü¾ßÓÐÒÔÏÂÁ½¸ö·½·¨£º
[WebMethod(EnableSession = true)]
public string Login(string name)
{
    Context.Session["name"] = name;
    return name;
}
[WebMethod(EnableSession = true)]
public string GetName()
{
    if (Context.Session["name"] != null)
        return Context.Session["name"].ToString();
    else
        return "";
}
3 Ìí¼Óasp.netÒ³ÃæSessionInWebservice.aspx
<form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtName" runat="server"></asp:TextBox>
        <asp:Button ID="btnLogin" runat="server"
            Text="Login" OnClick="btnLogin_Click" />
    </div>
    <div>
        <asp:Button ID="btnGetName" runat="server"
            Text="GetName" OnClick="btnGetName_Click" />
        <asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>
    </div>
</form>
SessionInWebservice.aspx.cs
protected void btnLogin_Click(object sender, EventArgs e)
{
    WebService ws = new WebService();
   
    ws.Login(txtName.Text);
}
protected void btnGetName_Click(object sender, EventArgs e)
{
    WebService ws = new WebService();
    lblName.Text = ws.GetName();
}
ÎÊÌâËƺõµ½´Ë½áÊøÁË£¬°´Login°´Å¥¼Ç¼Óû§ÃûÒÔºó£¬ÔÙ°´GetName¾Í¿ÉÒÔ»ñÈ¡µ½¸Õ²ÅÊäÈëµÄ


Ïà¹ØÎĵµ£º

ASP.NET web app performance issue ThreadPool

 
One of my bank customers planned to roll out a new ASP.NET web application serving as their critical internet banking portal. They faced some weird performance issue in their UAT environment. They noticed the CPU utilization was really high (above 90%) without any fluctuation. After checking ......

ASP.netÒ³ÃæÌøת·½Ê½ÈýÖÖ

 
asp.netÔÚ¿ª·¢Ê±,ÔÚ²»Í¬µÄÒ³Ãæ¼äÌøתÊÇÎÒÃdz£Óöµ½µÄÒ»¼þÊÂ,µ±Ò»¸ö¸´ÔÓµÄÂß¼­ÔÚÒ»¸öÒ³Ãæ·Å²»Ï·ֳɶþ¸ö»ò¶à¸öÒ³Ãæ´¦Àí¾ÍÐèÒªÔÚÒ³Ãæ¼äÌøת,ÓõÄ×î¶à»¹ÊÇÓû§µÄµÇ½°É.
ASP.NETÓõÄ×î¶àµÄÌøתÊÇResponse.Redirect,Õâ¸öÃüÁî¿ÉÒÔÖ±½Ó°ÑÇëÇóÖض¨Ïòµ½Ò»¸öÏà¶Ô»ò¾ø¶ÔµÄ·¾¶.Ëü»á°Ñµ±Ç°Ò³ÃæµÄµÄHttpÁ÷×è¶ÏÖ±½ÓÖض¨Ïòµ½ÐµÄU ......

asp.netµÄÒ»¸ödbhelperÀà

using System;
using System.Collections;
using System.Collections.Specialized;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections.Generic;
using System.Text;
namespace Maticsoft.DBUtility
{
     /// <summary>
  ......

ASP.NET 檔°¸ÏÂ載

//TransmitFileʵÏÖÏÂÔØ
    protected void Button1_Click(object sender, EventArgs e)
    {
        /*
        Î¢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öеķ½·¨TransmitFileÀ´½â¾öʹÓÃRespo ......

ASP.NET ViewState ¼ò½é

  ASP.NET ViewState ÊÇÒ»ÖÖеÄ״̬·þÎñ£¬¿É¹©¿ª·¢ÈËÔ±»ùÓÚÿ¸öÓû§À´¸ú×Ù UI ״̬£¬¸Ã¸¨ÖúÊý¾Ý±»´æ´¢ÔÚÒ»¸öÃûΪ __VIEWSTATE µÄÒþ²Ø×Ö¶ÎÖС£
    µ±È»£¬ ViewState ÔÚ ASP.NET ÖÐÓиöÖØÒªµÄ½ÇÉ«¡£Èç¹ûʹÓÃÇ¡µ±£¬ËüÄܹ»¼ò»¯Ò³Ã濪·¢£¬¸Ä½øÓû§ÓëÕ¾µãµÄ½»»¥¡£Èç¹ûÖÃÖ®²»Àí£¬ËüÄܹ»ÏÔÖøÔö¼ÓÕ¾µãÏìÓ¦´óÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ