如何使用页面方法将类似C#的会话页面用于VB页面

时间:2014-11-10 10:13:08

标签: javascript c# asp.net vb.net

运行两次或多次后,它会给出像“空”一样的值或什么都没有。 怎么做? 我的第一页aa.aspx我做了 在javascript中

function InitializeRequest(path) {
// call server side method
PageMethods.SetDownloadPath(path);
}

代码

[System.Web.Services.WebMethod]
public static string SetDownloadPath(string strpath)
{
Page objp = new Page();
objp.Session["strDwnPath"] = strpath; 
return strpath;
}

aspx页面

<asp:ScriptManager EnablePageMethods="true" ID="MainSM" runat="server" ScriptMode="Release" LoadScriptsBeforeUI="true">

如何将strpath值转换为bb.aspx vb代码后面的???

1 个答案:

答案 0 :(得分:0)

试试这个

[System.Web.Services.WebMethod]
public static string SetDownloadPath(string strpath)
{
        HttpContext.Current.Session["strDwnPath"] = strpath;
        return strpath;
}