我在ASP.NET应用程序中使用下面的方法进行表单身份验证
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, true);
Run Code Online (Sandbox Code Playgroud)
如何检查用户是否已登录?如何获取登录用户的用户名?
如何为物业制作公共吸气剂和私人定位器?以下是否正确?
public String Password
{
set { this._password = value; }
}
private String Password
{
get { return this._password; }
}
Run Code Online (Sandbox Code Playgroud) 我使用SQL使用C#将数据插入SQL数据库文件,如下所示.
String cs = System.Configuration.ConfigurationManager.ConnectionStrings["connection1"].ConnectionString;
SqlConnection conn = new SqlConnection(cs);
String sql = "INSERT INTO User (login, password, status) " +
"VALUES (@login, @password, @status)";
SqlCommand comm = new SqlCommand(sql, conn);
comm.Parameters.Add("@login", System.Data.SqlDbType.VarChar);
comm.Parameters.Add("@password", System.Data.SqlDbType.VarChar);
comm.Parameters.Add("@status", System.Data.SqlDbType.Bit);
try
{
conn.Open();
Console.WriteLine(conn.ToString());
comm.ExecuteNonQuery();
conn.Close();
return true;
}
catch (Exception ex)
{
throw (ex);
}
finally
{
conn.Close();
}
Run Code Online (Sandbox Code Playgroud)
执行命令时出现以下错误.
关键字'User'附近的语法不正确:INSERT INTO用户(登录名,密码,状态)VALUES(@ login,@ password,@ status)
我该怎么解决这个问题?
编辑: 添加了错过的参数值..
comm.Parameters["@login"].Value = this.Username;
comm.Parameters["@password"].Value = this._password;
comm.Parameters["@status"].Value = this.Status;
Run Code Online (Sandbox Code Playgroud) 我有一些Facelets文件,如下所示.
WebContent |-- index.xhtml |-- register.xhtml |-- templates | |--userForm.xhtml | `--banner.xhtml :
两个页面都使用/templates目录中的模板.我/index.xhtml在浏览器中打开了.我得到生成的HTML输出.我在/index.xhtml文件中有一个链接/register.xhtml文件.但是,我/register.xhtml没有被解析并返回为普通的XHTML/raw XML而不是生成的HTML输出.当我在浏览器中右键单击页面并执行查看页面源代码时,我仍然看到XHTML源代码而不是生成的HTML输出.看起来模板没有得到应用.
但是,当我在浏览器的地址栏中打开#{...}相似内容<h:body>时,它会正确显示.这是怎么造成的,我该如何解决?
有没有更好的PHP CRUD代码生成器?
我想获得数据访问对象,业务对象和值对象.
很难满足我的需求,但我很高兴至少我能得到任何相关的.
[编辑]
我正在研究基于MVC的应用程序.
我正在使用自己的MVC框架.
我需要这个代码生成器来为MODEL部分生成代码.
例如实体类和值对象目前我的代码如下所示.
class CustomersDAO
{
public function add() {$CustomersVO}
public function update($CustomersVO) {}
public function delete() {}
public function get() {}
}
class CustomersVO
{
public $id;
public $name;
public $tp;
public $address;
}
class CustomerBO
{
private $id;
private $name;
private $tp;
private $address;
public function getID() {};
public function setID($val) {};
// other getters and setters gos here..
// other business logics
}
Run Code Online (Sandbox Code Playgroud) 我有一个用Laravel 5.2创建的API.我正在使用油门限速.在我的路线文件中,我设置了以下内容..
Route::group(['middleware' => ['throttle:60,1'], 'prefix' => 'api/v1'], function() {
//
}
Run Code Online (Sandbox Code Playgroud)
据我了解Laravel限制,上面的脚本会将请求限制设置为每分钟60.我有一个应用程序查询路由,每10秒重复一次.因此,每分钟有6个请求,更令人满意的是上述节流.
问题是,我的查询工作,直到我执行60请求,无论时间和60请求后,它429 Too Many Requests用标头响应我Retry-After: 60.根据我的理解,X-RateLimit-Remaining应该每1分钟更新一次.但它似乎永远不会更新,直到它变为0.变为零后,等待60秒然后更新.
我在这做错了吗?
我是JSF和托管bean的新手.我有一个托管bean,其中包含一些私有属性,包含公共setter和Getter方法.现在当我将托管bean的属性添加到JSF表单时,我应该直接添加私有方法还是应该使用Getter方法调用属性?
例如:
<h:inputText value="#{BeanName.userName}"/><h:inputText value="#{BeanName.getUserName()}"/>上面哪一个是正确的?
这是一个愚蠢的要求。然而,我问希望它可以节省我的时间,如果有人已经在任何开源站点上编写和发布,我可以重用。
我有一系列 MAC 地址。比如说
18:67:b0:7c:00:00 - 18:67:b0:7c:ff:ff
Run Code Online (Sandbox Code Playgroud)
我需要在上述范围内生成所有可能的 MAC 地址。谁能给我一个可以做到这一点的免费脚本?
我在 Drupal 模块中尝试了收音机的主题,覆盖了我的主题功能中的以下代码。对于实验,我没有更改以下函数中的任何内容,只是迁移到我的模块中,名称不同,不会与原始 api 函数冲突。
function theme_radios($element) {
$class = 'form-radios';
if (isset($element['#attributes']['class'])) {
$class .= ' ' . $element['#attributes']['class'];
}
$element['#children'] = '<div class="' . $class . '">' . (!empty($element['#children']) ? $element['#children'] : '') . '</div>';
if ($element['#title'] || $element['#description']) {
unset($element['#id']);
return theme('form_element', $element, $element['#children']);
}
else {
return $element['#children'];
}
}
Run Code Online (Sandbox Code Playgroud)
主题注册一切正常。不幸的是,我没有得到任何结果。我只能看到表单标签(Radios 的标签)。请问有什么想法吗?
编辑:我设法解决了它。谢谢大家!
请在以下情况下纠正我.(问题在最后)
(我问了一个类似的问题,这个问题是没有组织的,并且被投票结束.所以我把这里的问题概括为一个范围,可以回答确切的答案.)
我正在开发一个使用nhibernate作为ORM的多层Web应用程序.我的图层结构如下
使用上面的层,类和接口如下放置.
ProductController.cs(UI层)
public class ProductController : Controller
{
ProductServices _ProductServices;
NHibernate.ISession _Session;
public ProductController()
{
_Session = SessionManager.GetCurrentSession();
_ProductServices = new ProductServices(
new ProductRepository(), _Session);
}
// Cont..
}
Run Code Online (Sandbox Code Playgroud)
ProductServices.cs(服务层)
public class ProductServices : IProductServices
{
protected IProductRepository _ProductRepository;
protected NHibernate.ISession _Session;
public ProductServices(IProductRepository productRepository,
NHibernate.ISession session)
{
_ProductRepository = productRepository;
_Session = session;
_ProductRepository.SetSession(_Session);
}
// cont...
}
Run Code Online (Sandbox Code Playgroud)
ProductRepository.cs(存储库层)
public class ProductRepository : IProductRepository
{
NHibernate.ISession _Session;
public void SetSession(NHibernate.ISession session)
{ …Run Code Online (Sandbox Code Playgroud) 我有以下学说模型..
众议院主义实体
// Below are not my real object. These are example similar to my originals
// Doctrine entity
class House implements JsonSerializable {
// Doctrine properties
protected $id; // doctrine id field
protected $rooms; // rooms : one-to-many relation to Room doctrine entity.
// serializer
public function jsonSerialize() {
return [
'id' => $this->GetId(),
'rooms' => $this->GetRooms(),
];
}
// Getters & setters.
public GetId() { return $this->id; }
public SetId($id) { $this->id = $id }
public GetRooms() { …Run Code Online (Sandbox Code Playgroud) 我想在我的JSF Web项目上实现Ajax.我用Google搜索并发现ICEFaces正在使用JSF支持Ajax.但我不知道它的可用性.
任何人都有经验Ajax/JSF,请指导我去哪里.
[编辑]
如果有人遇到类似的情况,请分享可用性.好与坏..
c# ×3
php ×3
el ×2
jsf ×2
jsf-2 ×2
ajax ×1
api ×1
asp.net ×1
bash ×1
crud ×1
database ×1
doctrine-orm ×1
drupal-6 ×1
facelets ×1
java ×1
json ×1
laravel-5.2 ×1
nhibernate ×1
properties ×1
python ×1
radio-button ×1
sql ×1
sql-server ×1
t-sql ×1
throttling ×1