小编Sad*_*egh的帖子

从 RouteTable 检索路由值

我想从 RouteTable 检索路由值,但它为空。有人可以帮忙吗?

public static class GetRouteValues
{
    public static string GetSomeValue()
    {
        RouteCollection routes = RouteTable.Routes;
        var value = routes["somevalue"].ToString();
        return value;
    }
}
Run Code Online (Sandbox Code Playgroud)

我想检索此值以在 global.asax 文件中使用,并将其设置为某些路由值的默认值。

string value = GetRouteValues.GetSomeValue();
routes.MapRoute(null,
                        "{_value}/home",
                        new
                        {
                            _value = value,
                            controller = "home",
                            action = "index"
                        });
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc routetable

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

Windows 7中的管理员用户SQL Server 2008数据库引擎登录失败

我从sadegh用户在Windows 7 Ultimate上安装了SQL Server 2008 Enterprise Edition.

此帐户存在于管理员角色中.几天后我从Windows中删除了sadegh用户,现在我正在使用管理员用户.但我无法使用Windows身份验证方法登录到SQL Server数据库引擎,我收到此错误消息:

标题:连接到服务器

无法连接到SADEGH-PC.

附加信息:

用户'Sadegh-PC\Administrator'登录失败.(Microsoft SQL Server,错误:18456)

如需帮助,请单击:http: //go.microsoft.com/fwlink?ProdName = Microsoft + SQL + Server&EvtSrc = MSSQLServer&EvidID = 18456&LinkId = 20476

请帮我!谢谢

sql sql-server-2008

5
推荐指数
2
解决办法
5万
查看次数

在哪里托管静态内容:子域或不同的域?

将我们的应用程序静态内容托管在一个完全不同的域上,而不是像其他域一样托管在我们主域的子域上有什么好处吗?例如,微软使用i.microsoft.com,谷歌使用gstatic.com,雅虎使用yimg.com,Stackoverflow使用sstatic.net

提前致谢

performance seo cdn

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

如何从用户控件中删除不必要的属性?

我想从用户控件中删除不必要的属性.但我不知道怎么办?

c# user-controls properties

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

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

防止删除特定记录

我想防止删除特定记录。此触发器适用于该特定记录。但是,其他记录在删除时仍然保留。为什么?

 ALTER TRIGGER [Globalization].[CountriesTracker] 
 ON [Globalization].[Countries] 
 INSTEAD OF DELETE
 AS 
 BEGIN
SET NOCOUNT ON;
IF ((Select COUNT(*) from [Deleted]
     Where [Deleted].[CountryId] = '36bd1536-fb56-4ec4-957e-1b3afde16c56') = 1)
BEGIN       
    RAISERROR('You can not delete this specific record!', 0, 0)
    ROLLBACK TRANSACTION
    RETURN
END
END
Run Code Online (Sandbox Code Playgroud)

如何确保不符合上述条件的行按预期被删除?

sql-server triggers sql-server-2008-r2

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

如何防止连接波斯语字符?

我有一个问题,但也许这实际上不是问题!为什么即使使用 Arial 等标准字体,下面的 HTML 标记也会生成似乎不正确的结果?

\n\n
<span>\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85</span><span>\xd8\xae\xd8\xaf\xd8\xa7\xd8\xad\xd8\xa7\xd9\x81\xd8\xb8</span>\n
Run Code Online (Sandbox Code Playgroud)\n\n

\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85\xd8\xae\xd8\xaf\xd8\xa7\xd8\xad\xd8\xa7\xd9\x81\xd8\xb8

\n\n

上面的输出不应该是这个吗?(忽略用于模拟的空间)

\n\n

\xd8\xb3\xd9\x84\xd8\xa7\xd9\x85 \xd8\xae\xd8\xaf\xd8\xa7\xd8\xad\xd8\xa7\xd9\x81\xd8\xb8

\n\n

我也使用了标签的边距,但有同样的问题。\n提前致谢;)

\n

html css persian farsi

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

使用Windows身份验证方法的SVN权限管理工具

我们在Windows中使用VisualSVN Server作为SVN服务器.但它在管理权利方面的能力非常有限.此外,我们无法使用svn_access_file,因为我们的用户将使用Windows身份验证方法进行身份验证.

是否有任何工具来管理使用/支持Windows身份验证的权限?

svn windows visualsvn-server windows-authentication authz

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

隐藏IntelliSense的用户控件属性

如何在Visual Studio中隐藏IntelliSense的用户控件属性?

.net intellisense visual-studio

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

如何修改或添加新项目到通用的字符串列表

我想在单词列表中删除一些漂亮的单词.

public System.String CleanNoiseWord(System.String word)
{
    string key = word;
    if (word.Length <= 2)
        key = System.String.Empty;
    else 
        key = word;
    //other validation here
    return key;
}

public IList<System.String> Clean(IList<System.String> words)
{
    var oldWords = words;
    IList<System.String> newWords = new string[oldWords.Count()];
    string key;
    var i = 0;
    foreach (System.String word in oldWords)
    {
        key = this.CleanNoiseWord(word);
        if (!string.IsNullOrEmpty(key))
        {
            newWords.RemoveAt(i);
            newWords.Insert(i++, key);
        }
    }
    return newWords.Distinct().ToList();
}
Run Code Online (Sandbox Code Playgroud)

但我不能添加,删除或插入列表中的任何东西!发生异常NotSupportedException >> Collection的大小固定.我如何修改或添加新项目到通用的字符串列表?

c#

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

在路由参数上设置多个RouteConstraint

这是我正在使用的代码,但是编译器说:匿名类型不能具有相同名称的多个属性

context.MapRoute("RouteName", "statics/category/{fileName}",
                            new
                            {
                                controller = "myController",
                                action = "Index"
                            },
                            new
                            {
                                fileName = new fnRouteConstraint(),
                                fileName = new AnotherRouteConstraint()
                            });
Run Code Online (Sandbox Code Playgroud)

routes constraints asp.net-mvc-2

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