小编Jat*_*iya的帖子

如何在ASP.NET中获取当前域名

我想在asp.net c#中获取当前域名.

我正在使用此代码.

string DomainName = HttpContext.Current.Request.Url.Host;
Run Code Online (Sandbox Code Playgroud)

我的网址是,localhost:5858但它只是返回localhost.

现在,我在localhost中使用我的项目.我想得到localhost:5858.

再举一个例子,当我使用这个域名时

www.somedomainname.com
Run Code Online (Sandbox Code Playgroud)

我想得到 somedomainname.com

请告诉我如何获取当前域名.

c# asp.net

67
推荐指数
6
解决办法
12万
查看次数

如何在MVC项目中实现ASP.Net成员资格?

我是ASP.NET成员资格的新手。我想在ASP.NET MVC项目中实现ASP.NET成员资格。我不确定是否可能。

每当我们那时要创建MVC应用程序时,我们都会找到更改身份验证的选项(无身份验证,身份身份验证,组织等)。我选择了身份验证,并在我的应用程序中获得了那些表。看附件。

在此处输入图片说明

但是我不想要ASP.NET身份表和功能。

我想要附加 ASP.NET成员资格表和功能(用户CRUD操作,分配角色,更改用户密码等)。

在此处输入图片说明

我已经找到了在SQL Server中创建ASP.NET成员资格表的方法。

  1. 转到目录C:\ WINDOWS \ Microsoft.NET \ Framework \ v4.0.30319单击
  2. aspnet_regsql.exe。您将看到以下屏幕。

但是您还记得我们创建带有身份的MVC应用程序时,它们会提供内置的注册和登录功能(无需为此编写代码),是的,我也希望成为ASP.NET成员。

您的答案将不胜感激!:)

提前致谢 :)

authentication asp.net-mvc authorization asp.net-membership visual-studio

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

如何检查Solr中使用的是哪个XSLT处理器?

如何验证Solr中使用的是哪个XSLT处理器?我想将XSLT版本从1.0更改为2.0.

我正在使用Solr 4.0.

xslt solr

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

如何在XSLT中使用<![CDATA []]>?

我在XSLT变量中使用的样子如下:

<xsl:variable name="ShortDescription" select="str[@name = 'ShortDescription']"/>
<!--Short Description field-->
       <xsl:if test="$ShortDescription !=''">

        <shortdescription><![CDATA[ <xsl:value-of select="$ShortDescription" disable-output-escaping="no"/> ]]></shortdescription>

       </xsl:if>
Run Code Online (Sandbox Code Playgroud)

但它显示为文本而不是$ShortDescription变量和输出的值如下所示:

<shortdescription>
&lt;xsl:value-of select="$ShortDescription" disable-output-escaping="no"/&gt;
</shortdescription>
Run Code Online (Sandbox Code Playgroud)

预期输出看起来像:

<shortdescription>
<![CDATA[Maximum Power: 520 W<br/>+12V Rails: Dual<br/>]]>
</shortdescription>
Run Code Online (Sandbox Code Playgroud)

如何<![CDATA[]]>在XSLT中使用?

xml xslt

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

如何处理AdminTabStripCreated事件并使用插件中的内容?

我使用的是nopCommerce 3.40

我处理AdminTabStripCreated事件以从插件添加新选项卡.

我的代码看起来像:

public class AdminTabStripCreatedEventConsumer : IConsumer<AdminTabStripCreated>
    {
        public void HandleEvent(AdminTabStripCreated eventMessage)
        {

if (eventMessage.TabStripName == "customer-edit")
        {
         string URL="Nop.Plugin.UI.CustomerTabs.Views.test.customeradmin"
                string script = @"<style type=""text/css"">
                                .k-link {
                                    font-weight: bold;
                                }
                                </style>
                                <script language=""javascript"" type=""text/javascript"">
                                $(document).ready(function () {
                                var kTabs = $('#customer-edit').data('kendoTabStrip');
                                kTabs.append({ text: ""Tab Name"", contentUrl: ""**URL**"" });
                                });
                                </script>";
                eventMessage.BlocksToRender.Add(MvcHtmlString.Create(script));
            }
        }
     }
Run Code Online (Sandbox Code Playgroud)

使用时,此脚本选项卡已创建,但我想从插件中打开自定义视图页面.

请告诉我这个脚本中设置了哪种类型的URL.

提前致谢.

此致,贾丁

nopcommerce

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

获取错误:找不到方法:'Void RestSharp.RestClient.set_BaseUrl(System.String)'.在Twilio-CSharp

我正在使用MVC5应用程序并实现twilio rest api用于发送短信但我收到错误:

 var twilio = new TwilioRestClient(AccountSid, AuthToken);
Run Code Online (Sandbox Code Playgroud)

我的restsharp dll版本是105.0.1,而且我有104.4.0的旧版本,我尝试了twilio最新版本和旧版本,但似乎得到了错误.

类型"system.missingMethodException而"的例外发生在Nop.Plugin.SMSProvider.nopSMS.dll但在用户代码中没有处理

附加信息:找不到方法:'Void RestSharp.RestClient.set_BaseUrl(System.String)'.

我该怎么办?

c# dependencies nopcommerce twilio restsharp

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

如何在 C# 中删除 &lt;xml version="1.0"&gt; 元素

我在变量中的 xml 内容如下所示:

 var xml = DownloadString(@"http://192.168.1.50:8983/solr/core-live/select?q=*%3A*&wt=xslt&tr=custom.xsl");
Run Code Online (Sandbox Code Playgroud)

DownloadString 是一个函数/方法

public static string DownloadString(string address) 
     {
        string text;
         using (var client = new WebClient()) 
         {
           text = client.DownloadString(address);
         }
           return text;
      }
Run Code Online (Sandbox Code Playgroud)

当我在 xml 变量和 xml o/p 上调试时,看起来像:

<?xml version="1.0" encoding="UTF-8"?>
<xml version="1.0">
<item>
<sku>12944</sku>
<title>test</title</item>
</xml>
Run Code Online (Sandbox Code Playgroud)

我想从同一个变量中删除第二个节点(<xml version="1.0">)和最后一个节点(</xml>)。

然后在使用此将内容保存在 xml 文件中后:

 System.IO.File.WriteAllText("test.xml", xml);
Run Code Online (Sandbox Code Playgroud)

问候, Jatin

.net c# xml xml-parsing

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

获取错误:字符串未被识别为c#中的有效DateTime

得到如下错误:

mscorlib.dll中发生未处理的"System.FormatException"类型的异常附加信息:String未被识别为有效的DateTime.

我正在使用此代码:

string datetime = DateTime.Parse(encrypt[1]);
Run Code Online (Sandbox Code Playgroud)

要么

string datetime = Convert.ToDatetime(encrypt[1]);
Run Code Online (Sandbox Code Playgroud)

encrypt是一个字符串数组

encrypt[1]not sure which format will come in string.我跟踪了一段时间dd/MM/yyyy,有时MM/dd/yyyy或者 MM-dd-yyyydd-MM-yyyy.我不确定它可能来自上面或其他格式来.

也用ParseExceptTryParseExcept.但是没有成功似乎返回相同的错误

请给我适当的解决方案.

c# string datetime datetime-parsing

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

Getting black screen shot using screen capture method in c#

I am using screen capture method in my c# hands on. In local project everything is working fine. But when I am publishing my application to live domain then I am getting black screen shot.

I am using below two ways for active window screen capturing 1) http://www.tutorialized.com/tutorial/How-to-capture-web-page-screenshot-in-asp.net-using-c/67952 2) http://www.c-sharpcorner.com/article/screen-capture-and-save-as-an-image/

Above methods is working fine in local project. But after publishing screenshot is saving into drive but getting with black color (empty).

您的回答将不胜感激.

c# asp.net screen-capture

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