小编leg*_*ion的帖子

如何在ServiceStack中进行身份验证后重定向

我像这样覆盖了CredentialsAuthProvider:

public override bool TryAuthenticate(IServiceBase authService, string userName, string password)
        {
            //TODO: Auth the user and return if valid login
            return true;
        }

public override void OnAuthenticated(IServiceBase authService, IAuthSession session, IOAuthTokens tokens, Dictionary<string, string> authInfo)
        {
            base.OnAuthenticated(authService, session, tokens, authInfo);

            //User has been authenticated

            //Find the user's role form the DB

            if (roleA)
                //GOTO mypage1

            if (roleB)
                //GOTO mypage2
        }
Run Code Online (Sandbox Code Playgroud)

我对〜/ auth/Credentials执行一个简单的帖子,当身份验证工作并调用OnAuthenticated方法时,如何根据角色或类似的东西将用户重定向到适当的页面?

我厌倦了在OnAuthenticated方法中执行以下操作,但它没有达到预期的效果:

authService( "/视图/客户").

使用入门模板更新(请参阅下面的评论):

public class CustomCredentialsAuthProvider : CredentialsAuthProvider
    {
        public override bool TryAuthenticate(IServiceBase authService, string userName, string …
Run Code Online (Sandbox Code Playgroud)

.net c# servicestack

9
推荐指数
1
解决办法
3839
查看次数

如何在Silverlight Map Control中对推针进行聚类?

我有一个Silverlight应用程序,我正在使用Bing Map控件,我有大约2000个推针.性能有点迟钝,我想知道如何聚集推针以提高性能.

c# silverlight bing-maps

6
推荐指数
1
解决办法
865
查看次数

如何在C#中将3个字节转换为24位数?

我有一个字节数组,我从消息的标题部分读取.这些字节包含消息的长度.从不超过3个字节,它们从LSB到MSB排序.所以在下面的例子中,39是LSB,2是MSB.

var data = new byte[] { 39, 213, 2 };
Run Code Online (Sandbox Code Playgroud)

在上面的例子中,我如何获取这些字节并转换为数字(int,short等)?

c#

5
推荐指数
3
解决办法
7903
查看次数

RavenDB错误:日志文件版本与Jet版本不兼容

所以我使用以下指令在Win2003服务器上安装了RavendDB:

http://old.ravendb.net/documentation/docs-deployment-iis

当我尝试浏览到该网站时,我收到以下错误.有任何想法吗?

Version of log file is not compatible with Jet version 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: Microsoft.Isam.Esent.Interop.EsentBadLogVersionException: Version of log file is not compatible with Jet version

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the …
Run Code Online (Sandbox Code Playgroud)

ravendb windows-2003-webserver

1
推荐指数
1
解决办法
1189
查看次数