我已经解决了 Umbraco 中的 WEB API 实现的所有问题(在 http 帖子中创建令牌和成员),我在这里遇到的问题是这个最终的宏,我已经创建了一个 Umbraco 页面,它不会从查询字符串中收集令牌和电子邮件。我不断收到 System.Data.SqlClient.SqlException(期望参数'@token',未提供)我无法在 Umbraco 中获取查询字符串,或者更具体地说是 Umbraco 宏?
namespace ****.SSO
{
public partial class ****SSOMacro : System.Web.UI.UserControl,
umbraco.editorControls.userControlGrapper.IUsercontrolDataEditor
{
static Token token = new Token();
static string connStr = ConfigurationManager.ConnectionStrings["umbracoDbDSN"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{
try{
**string tmpToken = Request.QueryString["token"];
string tmpEmail = Request.QueryString["email"];
//Check If Token Still Exists
using (SqlConnection myConnection = new SqlConnection(connStr))
{
myConnection.Open();
SqlCommand command = new SqlCommand("SELECT * FROM [DBTokenTable] WHERE tokens = @token and email = @email and valid = 'true'", myConnection);
command.Parameters.AddWithValue("@token", tmpToken);
command.Parameters.AddWithValue("@email", tmpEmail);
using (SqlDataReader reader = command.ExecuteReader())
{
while (reader.Read())
{
token = new Token { token = reader["Tokens"].ToString(), email = reader["Email"].ToString(), valid = reader["Valid"].ToString() };
}
}
myConnection.Close();
}**
}
catch (Exception ex)
{
string error = ex.ToString();
//Log Any Form Cookies Out
FormsAuthentication.SignOut();
RawrLabel.Text = error;
//Response.Redirect(HttpUtility.UrlEncode("https://google.com/#q=" + error));
}
}
private string _umbval;
public object value
{
get { return _umbval; }
set { _umbval = value.ToString(); }
}