小编Com*_*ter的帖子

从成功的条带结账重定向

我正在使用带有 C# .Net 的 Stripes 支付网关。我首先创建一个结账,将用户重定向到 Stripe 的支付网关(我不想维护卡号等麻烦,所以这样它会转发到 Stripe 询问卡详细信息、处理付款等)https://stripe .com/docs/ payments/checkout/one-time - 这是在代码隐藏中完成的。

我将成功 URL 设置为 www.example.com/myHandler.ashx(通用处理程序)- 此 URL 将订单 ID 设置为成功。我的处理程序代码类似于https://stripe.com/docs/webhooks/build(因为我使用通用处理程序,所以我使用表单而不是 MVC)

付款成功后,付款会记录到我的数据库中。

考虑到这是一个网络钩子,我如何显示/重定向到感谢页面?

c# asp.net webhooks generic-handler stripe-payments

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

无法在UpdatePanel中下载文件

下面的代码可以让我下载一个Word文档.....

   Try
        Response.BufferOutput = True
        HttpContext.Current.Response.Clear()
        HttpContext.Current.Response.Charset = ""
        HttpContext.Current.Response.ContentType = "application/msword"
        HttpContext.Current.Response.AddHeader("Content-Disposition", "inline;filename=myfile.doc")
        HttpContext.Current.Response.Write(s)
        'HttpContext.Current.Response.End()
        HttpContext.Current.ApplicationInstance.CompleteRequest()
        HttpContext.Current.Response.Flush()
    Catch ex As Exception
        Response.Write(ex.Message)
    End Try
Run Code Online (Sandbox Code Playgroud)

但是,只要我添加一个UpdatePanel - 它没有下载文件,没有生成错误?阅读后,我添加了一个触发器,其ControlID值设置为开始创建Word doc文件的按钮.我已经尝试了几种代码组合,但似乎没有任何效果.有关如何缩小范围的任何帮助?我也调试了,没有错误显示.我检查了我的下载文件夹 - 没有任何东西,尝试设置无缓存(Response.Cache.SetCacheability(HttpCacheability.NoCache)),并没有工作.一旦我删除UpdatePanel,那么一切似乎都有效?

   <asp:UpdateProgress ID="ProgressUpdate" AssociatedUpdatePanelID="UpdatePanel1" runat="server">
        <ProgressTemplate>
            <img alt="progress" src="../images/loading.gif" />
        </ProgressTemplate>
    </asp:UpdateProgress>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
     <Triggers>
            <asp:PostBackTrigger ControlID="buttonDownloadFile" />
     </Triggers>
       <ContentTemplate>
        ..
Run Code Online (Sandbox Code Playgroud)

完全失去了这一个.任何人都可以建议解决方法或如何解决这个问题?

.net vb.net asp.net updatepanel http

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

reCAPTCHA 已在此元素中呈现

我有一个使用 ASP .Net 使用 updatepanel 构建的简单联系表单。一切都按预期工作,但我看到了错误

recaptcha__en.js:未捕获的错误:reCAPTCHA 已在此元素中呈现

在控制台窗口中

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script src="https://www.google.com/recaptcha/api.js?onload=pageLoad&render=explicit" async defer></script>

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
        <div class="g-recaptcha" data-sitekey="XXXX"></div>
    </ContentTemplate>
</asp:UpdatePanel>

<script language="javascript" type="text/javascript">
    function pageLoad() {
        $('.g-recaptcha').each(function (index, obj) {
            grecaptcha.render(obj, { 'sitekey': 'XXXX' });
        });
    }
</script>
Run Code Online (Sandbox Code Playgroud)

我最初添加时onload=pageLoad&render=explicit好像没有检查验证码,然后单击按钮发送,验证码消失了。添加onload=pageLoad&render=explicit到脚本行解决了这个问题,但现在我收到了上述错误。

如果我尝试删除某些元素,那么其他内容会中断,即验证码不显示或不显示在回发中?

javascript asp.net updatepanel recaptcha google-apps-script

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

在Ctrl + K Ctrl + D之后删除空行

在VS 2012及更早版本中,我可以按CTRL+ KCTRL+ D会改变

<div>

   <div>

      <asp:TextBox runat="server" Id="Textbox1"></asp:/TextBox>

   </div>
</div>
Run Code Online (Sandbox Code Playgroud)

<div>
   <div>
      <asp:TextBox runat="server" Id="Textbox1"></asp:/TextBox>
   </div>
</div>
Run Code Online (Sandbox Code Playgroud)

因此,它将删除多余的行。在VS 2013我做同样的事情时,它不能正确格式化(或以我喜欢的方式)。

我查看了“ 工具”下的内容,但看不到能解决问题的任何东西,我还安装了Productivity Power Tools,并且再次没有删除多余行的选项。

反正这吗?

编辑1

使用\ n \ n和\ n 搜索

visual-studio visual-studio-2013

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

仅限Chrome中的HTTP状态代码405无效

我有一个WCF服务,它将客户保存到数据库,并在Internet Explorer中按预期工作,不在 Chrome中工作(因此我会遗漏HTML/Json,因为它让我觉得这是一个Web配置问题,但我可以发布如果有人喜欢).

在Chrome中我收到错误:

无法加载资源:服务器响应状态为405(方法不允许)Subscriber.htm:1 XMLHttpRequest无法加载http://example.com/MyService.svc/SaveCustomer.无效的HTTP状态代码405

我的网站配置:

<system.web>
    <compilation debug="false" strict="false" explicit="true" targetFramework="4.0" />
    <pages>
      <namespaces>
        <add namespace="System.Runtime.Serialization" />
        <add namespace="System.ServiceModel" />
        <add namespace="System.ServiceModel.Web" />
      </namespaces>
    </pages>
  </system.web>
  <system.serviceModel>
      <services>
      <service name="IService.MyService">
        <endpoint address="http://example.com/MyService.svc"
          binding="webHttpBinding" 
          bindingConfiguration="" 
          contract="IService" 
          behaviorConfiguration="webHttpBinding" />
      </service>
    </services>
    <client>
      <endpoint 
      binding="webHttpBinding" 
      bindingConfiguration="" 
      address="http://example.com/MyService.svc"
        contract="IService" />
    </client>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
          <serviceMetadata httpGetEnabled="true"/> …
Run Code Online (Sandbox Code Playgroud)

.net wcf google-chrome wcf-binding

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

如何在ASP.NET WebForm中使用Ninject注入依赖项?

我对使用存储库模式有一个很好的想法,并一直试图"升级"我们目前创建ASP .Net网站的方式.所以我做了以下几点

  1. 使用名为DataAccessLayer的类项目和另一个名为BusinessLogicLayer的类项目创建解决方案.最后是第三个项目,这是我的ASP .Net网站(一个普通网站).
  2. 我将一个dbml文件添加到DAL并拖动一个表,然后在我的BLL中添加一个接口和一个实现此接口的类:

我的界面

namespace BLL.Interfaces
{
    interface IUser
    {
        List<User> GetAllUsers();
    }
}
Run Code Online (Sandbox Code Playgroud)

在我的班上

namespace BLL.Services
{
   public class UserService : BLL.Interfaces.IUser
    {
        public List<User> GetUsers()
        {
            throw new NotImplementedException();
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我知道代码没有完全完成,但出于说明的目的.

所以我右键单击BLL项目>管理NuGet包>搜索Ninject并找到一些.经过进一步的研究后,我失去了如何将Ninject添加到普通的ASP .Net网站,我对这些条目的数量感到不知所措?具体哪个添加我需要?由于有很多MVC和阅读进一步我认为我有点困惑.

我试图将它添加到BLL项目,因为我认为它应该去,所以我可以在那里注册我的服务.

任何人都可以指导我,我需要这样才能使用Ninject条目,但我不使用MVC?

asp.net dependency-injection ninject repository-pattern

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

Musicbrainz 艺术家形象和信息

我已设法使用以下方法获取艺术家的信息

http://musicbrainz.org/ws/2/artist/?query=artist:michael%20jackson
Run Code Online (Sandbox Code Playgroud)

它返回 MBID(或 ID)。这里的响应返回了很多信息,但不是艺术家的图像。

因此,进一步阅读使我找到了 CoverArt ( https://musicbrainz.org/doc/Cover_Art ) 和https://archive.org/并获得了一张图片,它使我进入了此链接https://musicbrainz.org/doc/ Cover_Art_Archive/API,它针对的是发行版而不是艺术家(我理解它的方式是,这release是艺术家所做的专辑的艺术品,但我需要的是artist它本身的图像。

我不确定如何获得艺术家的形象,或者我是否因为阅读了很多链接而走错了路,但我认为我在这里遗漏了一些东西,想知道是否有人可以提供建议?据我所知并认为我需要艺术家的 ID 开始,但使用release实体不会返回艺术家的图像,我用替换releaseartist但会返回 404。

web-services musicbrainz

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

Instagram 新客户端注册已禁用

我正在使用 SkyBrud ( https://social.skybrud.dk/instagram/ ) 并且通常在 Umbraco/ASP .net 站点中使用此 API 设置 Instagram。该网站会将图像从 Instagram 显示到我的网站,该网站通过在 Instagram 上生成的 API 密钥连接并在我刚刚链接的服务中使用它们。

最近我决定创建一个新帐户(Insta)以获取一些 Instagram API 密钥。在第一步之后,我看到“注册已禁用”并且无法继续获取 API 密钥。

根据上面的网站,我得到了不再支持的愿景。然后我遇到了如何找到 Instagram 开发人员支持?有类似的问题,但有些人通过移动应用程序对其进行了排序,我认为这很奇怪,而其他答案与 Android 相关,因此认为它不适用于我。

然后我阅读了指向 Facebook https://developers.facebook.com/docs/instagram-basic-display-api/getting-started 的其他链接,但我不知道这一步是否是让现有功能正常工作的正确步骤起来又快?

方向太多了,所以我不确定该走哪条路来获取 API?

facebook instagram umbraco7 instagram-api

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