小编Sha*_*ard的帖子

字符串未被识别为有效的DateTime,asp.net

,嗨,

我有一个asp.net和c#网站.

在我使用的asp代码中

<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"></asp:ScriptManager>
Run Code Online (Sandbox Code Playgroud)

当我运行我的项目时,我收到此错误:

字符串未被识别为有效的DateTime.

我在我的网站上没有使用任何dataTime的东西.

然后,当我刷新页面时,错误消失.

堆栈跟踪:

 [FormatException: String was not recognized as a valid DateTime.]
   System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles) +3610514
   System.Windows.Forms.TypeLibraryTimeStampAttribute..ctor(String timestamp) +49
   System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs) +0
   System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs) +46
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +529
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Boolean inherit) +33
   System.Web.UI.AssemblyCache.GetAjaxFrameworkAssemblyAttribute(Assembly assembly) +76
   System.Web.UI.ScriptManager.get_DefaultAjaxFrameworkAssembly() …

c# asp.net datetime scriptmanager

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

创建小按钮

我的意图是在一行中创建许多按钮,所以我认为每个按钮必须很小.

如何创建这样的小按钮?
我想要的是

我尝试了下面的代码,但它不相似.
我得到了什么

这是我的 style.xml

<style name="RightLink2" parent="@android:style/Widget.Button.Small">  
  <item name="android:layout_height">wrap_content</item>
  <item name="android:layout_width">wrap_content</item>
  <item name="android:padding">2dip</item>  
  <item name="android:textSize">10dp</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这是我的layout.xml

<LinearLayout android:layout_width="match_parent" android:id="@+id/linearLayout1" android:orientation="horizontal" android:layout_height="wrap_content" android:weightSum="1">
    <Button android:id="@+id/myButton"        
    style="@style/RightLink2"
    android:text="Click here"/>        
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android android-layout

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

如何使用c#.net删除前缀

<AcknowledgementList xmlns="http://www.irs.gov/efile" xmlns:efile="http://www.irs.gov  /efile">

     <efile:Acknowledgement>
 <efile:SubmissionId>*********</efile:SubmissionId>
     <efile:EFIN>465465</efile:EFIN>
     <efile:TaxYear>2011</efile:TaxYear>
     <efile:GovernmentCode>OHST</efile:GovernmentCode>
     </efile:Acknowledgement>
</AcknowledgementList>
Run Code Online (Sandbox Code Playgroud)

任何机构都可以告诉我从这个删除前缀efile的最佳方法是什么?

c#

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

ASP MVC获取控制器/操作名称?

在ASP.NET MVC中,如何根据请求URL获取控制器/操作名称?

网址示例:http://contoso.com/View/Comment/1

我想得到:

  • "查看"作为控制器名称
  • "评论"作为行动名称

基于HttpContext.Current.Request.

asp.net asp.net-mvc

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

谷歌在jsFiddle中映射

我正试图在jsFiddle中实现谷歌地图问另一个问题,但我看不到地图:http: //jsfiddle.net/hashie5/aknYP/

我在资源中添加了gmap脚本

如何在jsFiddle中显示地图?

function initialize() {
var myLatlng = new google.maps.LatLng(50.965049,5.484231);
var myOptions = {
  zoom: 14,
  center: myLatlng,
  mapTypeId: google.maps.MapTypeId.ROADMAP
}

var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);

var contentString = 
    '<div id="infowindow">' +
    'Galaconcert<br />' +
    'Jaarbeurslaan 2-6<br />' +
    '3690 Genk' +
    '</div>'
;

var infowindow = new google.maps.InfoWindow();

var marker = new google.maps.Marker({
    position: myLatlng,
    map: map,
    title: 'Galaconcert'
});
google.maps.event.addListener(marker, 'click', function() {
    infowindow.setContent(contentString);
    infowindow.open(map, marker);
});
}
Run Code Online (Sandbox Code Playgroud)

javascript google-maps jsfiddle

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

这是否为SQL注入打开了大门?

设置我的var:

Foo = request("Bar")
Run Code Online (Sandbox Code Playgroud)

构建SQL查询:

John.Source = "SELECT ID, Name FROM dbo.USER where Name = '"&Foo&"' and ID = '1'"
Run Code Online (Sandbox Code Playgroud)

我在某个项目中找到了这个,这是否为SQLi打开了大门?

sql-injection asp-classic

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

(有时)字典中没有给定的键

我使用下面的代码启动带有列表参数的线程,但有时它会引发异常:

给定的密​​钥不在字典中

从这一行:

Thread MoveThread = new Thread(() => MoveTask(ControllerDictionary[i]));
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个错误?

完整代码:

var ControllerDictionary = ConfigFile.ControllerList.Select((c, i) => new { Controller = c, Index = i })
    .GroupBy(x => x.Index % AppSettings.SimultaneousProcessNumber)
    .Select((g, i) => new { GroupIndex = i, Group = g })
    .ToDictionary(x => x.GroupIndex, x => x.Group.Select(xx => xx.Controller).ToList());

for (int i = 0; i < ControllerDictionary.Count; i++)
{
     Thread MoveThread = new Thread(() => MoveTask(ControllerDictionary[i]));
     MoveThread.Start();

     foreach (var Controller in ControllerDictionary[i])
         Logger.Write(string.Format("{0} is in move thread …
Run Code Online (Sandbox Code Playgroud)

c# multithreading dictionary

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

经典asp中的Javascript代码

你好我有一个JavaScript代码,我想在ASP文件中使用它,但我的错误代码说:

Active Server Pages错误'ASP 0138'

嵌套脚本块

/reklamsag.html,第3行

脚本块不能放在另一个脚本块中.

我的代码是:

<script src="http://ad.reklamport.com/scripts/rp.js" type="text/javascript"></script>
<script type="text/javascript">
    document.write("<script src='http://ad.reklamport.com/rpgetad.ashx?tt=t_canvecan_anasayfa_300x250&ciid=&rnd="+Math.random()%99999999+"'></"+"script>");
</script>
Run Code Online (Sandbox Code Playgroud)

有人说在外部文件中使用代码并将其包含在asp文件中我使用此包含代码,但它不起作用:

<!--#include file="reklamsag.html"-->
Run Code Online (Sandbox Code Playgroud)

javascript asp-classic

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

如何使用Substring,在第一个char之后返回所有值的整数

我有一个字符串AssetNumber具有以下格式C100200.所以我需要做的是: -

  1. 获取第一个之后的所有字符(例如,使用上面的例子100200)

  2. 将子字符串转换为整数

  3. 返回整数+ 1

但我不知道如何使用子字符串获取第一个字符后的所有字符,以及如何将字符串转换为int?任何有关这方面的帮助将不胜感激.

c#

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

对MSIL感到困惑

我读了c#程序编译需要两个步骤.

首先它生成MSIL然后生成机器代码.所以我很想看到第一阶段编译(MSIL)生成的文件.

我一直在想DLL文件是包含MSIL代码的文件,但我认为我错了.

.net c# cil

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