我正在使用ASP.net MVC3制作一个Web应用程序.我最终想要使用登录表单使用的roleprovider和身份验证.所以我有这个代码:
<authentication mode="Forms">
<forms loginUrl="~/Home/Login" timeout="2880" />
</authentication>
<roleManager enabled="true" defaultProvider="MyRoleProvider">
<providers>
<add name="MyRoleProvider"
type="StudentAdministratieProject.Authorisation.CustomRoleProvider"/>
</providers>
</roleManager>
Run Code Online (Sandbox Code Playgroud)
这段代码显然位于我的web.config中.
我启动应用程序时遇到的错误:
无法加载文件或程序集MySql.Web,Version = 6.7.4.0,Culture = neutral,PublicKeyToken = c5687fc88969c44d或其中一个依赖项无法加载.系统找不到给定的文件.**请注意,这大致是由荷兰语翻译而来,错误最初是荷兰语.
有任何想法吗?我搜索了很多但找不到任何帮助我的东西!
一旦点击,我想使用注释.我查了一下Apple的文档并且用谷歌搜索了但我无法找到为什么这与应该如何完成有什么不同.基本上; 我没有得到println("Pin clicked");
为什么不?
func mapView(mapView: MKMapView!, viewForAnnotation annotation: MKAnnotation!) -> MKAnnotationView!
{
if !(annotation is MKPointAnnotation) {
return nil
}
let reuseId = "test"
var anView = mapView.dequeueReusableAnnotationViewWithIdentifier(reuseId)
if anView == nil {
anView = MKAnnotationView(annotation: annotation, reuseIdentifier: reuseId)
anView.canShowCallout = true
}
else {
anView.annotation = annotation
}
return anView
}
func mapView(mapView: MKMapView!, didSelectAnnotationView view: MKAnnotationView!)
{
println("Pin clicked");
}
func setAnnotationPinOnMap(annotation : NSManagedObject)
{
var subject: AnyObject? = annotation.valueForKey("subject")
var desc: AnyObject? = annotation.valueForKey("desc")
var …Run Code Online (Sandbox Code Playgroud) 我创建了一个网页,其中包含一个包含剃刀形式的页面.用户可以登录此表单,然后重定向到其他页面.登录(和注销)成功地与formsauthentication一起使用.但是,我似乎无法使用HttpContext.Current.User.Identity.Name来检索存储的用户名(在formsauthentication cookie中).它返回一个空字符串"".
我使用的是MVC 5和ASP 4.5,没有标准的成员资格或角色提供者.
登录:
[HttpPost]
public ActionResult Login(User user)
{
if (ModelState.IsValid)
{
bool authenticated = userscontroller.isAuthorized(user.Email, user.Password);
if (authenticated)
{
if (userscontroller.isAuthenticated())
{
userscontroller.deAuthenticateUser();
}
userscontroller.authenticateUser(user);
return Redirect(Url.Action("Index", "Home"));
}
}
}
Run Code Online (Sandbox Code Playgroud)
验证用户:
public void authenticateUser(User user)
{
FormsAuthentication.SetAuthCookie(user.Username, false);
}
Run Code Online (Sandbox Code Playgroud)
然后获取用户的名称:
public User userFromCookie()
{
if (isAuthenticated())
{
return getUserByUsername(HttpContext.Current.User.Identity.Name);
}
else { return null; }
}
Run Code Online (Sandbox Code Playgroud)
isauthenticated()
public bool isAuthenticated()
{
if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated)
{
return true;
}
else
{
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
Webconfig:
<authentication …Run Code Online (Sandbox Code Playgroud) 在您提出 GridBagLayout 建议之前,我已经尝试过,但无法使其工作。我想要一个尺寸为 800 x 800 且中心面板为 600x600 的框架。现在,当我运行它时,中心面板是 600x578。有人能告诉我哪里出了问题吗?它只有 22 像素。
public void createPlayground()
{
JFrame frame = new JFrame("ForFun Maze");
frame.setSize(WIDTH, HEIGHT);
frame.setResizable(false);
frame.setLayout(new BorderLayout());
JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(3,1));
buttonPanel.setPreferredSize(new Dimension(100,600));
buttonPanel.setMaximumSize(new Dimension(100,600));
buttonPanel.setBackground(SIDEBAR);
JButton reset = new JButton();
reset.setText("Reset");
reset.addActionListener(new RestartListener());
reset.setSize(100,180);
JButton pause = new JButton();
pause.setText("Pause");
pause.setSize(100,180);
pause.addActionListener(new PauseListener());
JButton quit = new JButton();
quit.setText("Quit");
quit.setSize(100,180);
quit.addActionListener(new QuitListener());
buttonPanel.add(pause);
buttonPanel.add(reset);
buttonPanel.add(quit);
Location[][] array = null;
if(level == 1)
{
array = glevel1; …Run Code Online (Sandbox Code Playgroud) 我找不到下面代码无效的原因.这似乎是一个普通的"测试"警报,但它不起作用!
这是一个带有以下代码的.php文件:
<?php
require_once('../../usefull/functions');
if(!session->loggedIn)
{ redirect_to("../index.php"); }
?>
<link href="../ssheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../scripts/Image.js"></script>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
alert("hello");
});
</script><?php
<div id="imagelist"></div>
Run Code Online (Sandbox Code Playgroud)
提前致谢!
回答:
我的SelectImage文件中出现了一个错误.调用了一个在此特定PHP文件中不存在的元素.