问题列表 - 第23812页

使用ASP.NET开发服务器测试多个域

我正在开发一个单独的Web应用程序,它将根据用于访问该站点的域名动态更改其内容.多个域将指向同一个应用程序.我希望使用以下代码(或关闭的东西)来检测域名并执行自定义:

string theDomainName = Request.Url.Host;

switch (theDomainName)
{
  case "www.clientone.com":
    // do stuff
    break;
  case "www.clienttwo.com":
    // do other stuff
    break;
}
Run Code Online (Sandbox Code Playgroud)

我想使用ASP.NET开发服务器测试上面的功能.我在本地HOSTS文件中创建了映射,以将www.clientone.com映射到127.0.0.1,将www.clienttwo.com映射到127.0.0.1.然后,我使用www.clinetone.com(等)浏览器浏览应用程序.

当我尝试使用ASP.net开发服务器测试此代码时,URL始终显示localhost.它不捕获在浏览器中输入的主机,仅捕获localhost.

有没有办法使用开发服务器测试URL检测功能?

谢谢.

asp.net visual-studio-2008

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

使用malloc分配的内存不会在函数范围之外保留?

嗨,

我对C的malloc函数有点新,但据我所知,它应该将值存储在堆中,因此您可以使用来自原始范围之外的指针来引用它.我创建了一个应该执行此操作的测试程序,但在运行程序后,我一直得到值0.我究竟做错了什么?

#include <stdio.h>
#include <stdlib.h>

int f1(int *b) {
    b = malloc(sizeof(int));
    *b = 5;
}

int main(void) {
    int *a;
    f1(a);
    printf("%d\n", a);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

c malloc

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

语言是否需要preIncrement(++ x)和postIncrement(x ++)

我从未在实际代码中看到用于预增量后增量的用例.我经常看到它们的唯一地方是谜题.
我的观点是,它引入了更多的混淆而不是有用.

  • 是否有任何真实的用例场景
  • 这不能通过使用+ =来完成

    y = x++

    y = x
    x += 1

programming-languages increment pre-increment post-increment

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

如何从服务器端关闭Modal popup Extender

如何关闭Modal Popup Extender服务器端代码点击弹出窗口内的关闭链接?

asp.net modalpopupextender

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

为什么我的打印不起作用?

在下面的程序中我打印div的内容当我点击打印按钮我收到一条警告消息打印机错误不可用为什么它是这样的

<html>
<head>
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.min.js" > </script> 
<script type="text/javascript">

    function PrintElem(elem)
    {
        Popup($(elem).text());
    }

    function Popup(data) 
    {
        var mywindow = window.open('', 'my div', 'height=400,width=600');
        mywindow.document.write('<html><head><title>my div</title>');
        /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
        mywindow.document.write('</head><body >');
        mywindow.document.write(data);
        mywindow.document.write('</body></html>');
        mywindow.document.close();
        mywindow.print();
        return true;
    }

</script>
</head>
<body>

<div id="mydiv">
    This will be printed. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a quam at nibh adipiscing interdum. Nulla vitae accumsan ante. 
</div>


<input type="button" value="Print Div" onclick="PrintElem('#mydiv')" />

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

html javascript

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

单击下拉菜单时,MFC组合框控件未显示完整的项目列表

我在MSVS 2008中编写了一个应用程序,它有一个ComboBox控件,我通过以下代码初始化:

static char*                    OptionString[4] = {"Opt1",
                                                   "Opt2",
                                                   "Opt3",
                                                   "Opt4"};


BOOL CMyAppDlg::OnInitDialog()
{
    CDialog::OnInitDialog();

 // Set the icon for this dialog.  The framework does this automatically
 //  when the application's main window is not a dialog
 SetIcon(m_hIcon, TRUE);   // Set big icon
 SetIcon(m_hIcon, FALSE);  // Set small icon

    // TODO: Add extra initialization here

    m_Option.AddString(OptionString[0]);
    m_Option.AddString(OptionString[1]);
    m_Option.AddString(OptionString[2]);
    m_Option.AddString(OptionString[3]);
    m_Option.SetCurSel(0);

    return TRUE;  // return TRUE  unless you set the focus to a control
}
Run Code Online (Sandbox Code Playgroud)

在上面的代码中,m_Option是ComboBox控件的Control变量.

现在,当我构建应用程序并单击向下箭头时,下拉框仅显示第一个选项(因为我通过我的代码选择了该选项).但是,如果我按下键盘上的向下箭头键,它会按照我插入的顺序循环选项,但从不在框中显示超过1个选项.因此,如果用户想要选择option3,他必须循环选项1和2 !! 虽然一旦我使用键盘选择任何选项,相应的事件处理程序就会被触发,我对此行为感到恼火,这是可以理解的.

我也列出了组合框控件的属性 …

mfc combobox visual-studio-2008 visual-c++ drop-down-menu

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

关闭嵌入Python解释器的应用程序时tk85.dll出现问题

我的C++应用程序嵌入了Python解释器,但在关闭时似乎遇到了一些麻烦.在主窗口关闭后,我得到一个分段错误(这是Windows,但无论如何我们称之为分段错误).堆栈跟踪如下:

#0 102AD580 tk85!Tk_MainWindow() (C:\Users\... 1.3\bin\Debug\lib\tk85.dll:??)
#1 103082DD tk85!XSetStipple() (C:\Users\... 1.3\bin\Debug\lib\tk85.dll:??)
#2 102214A3 ??() (C:\Users\...1.3\bin\Debug\lib\tk85.dll:??)
#3 10220000 ??() (??:??)
#4 00000000 ??() (??:??)
Run Code Online (Sandbox Code Playgroud)

我甚至会在哪里开始调试这个问题?它似乎是可重复的.

c++ python embed tkinter

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

运行我自己的jabber/xmpp服务器

  1. 我可以制作自己的jabber服务器.所以,如果我运行我的网站xyz,那么人们应该能够通过在我的网站上注册从我的网站获取他们的jabber id.
  2. 有没有我可以使用的jabber服务器的开源实现?

chat xmpp

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

如何使用jQuery .ajax()读取目录?

使用jQuery .ajax()阅读" ./ex.html第一警告框"返回文件的预期内容.使用相同的调用只需将请求更改为" ./",就不会在第二个警告框中返回预期的目录列表.

<html>
<head>
</head>
<body>
<script type="text/JavaScript" src="jquery.js"></script>
<script type="text/JavaScript">
    alert($.ajax({type: "GET", url: 'ex.html', async: false}).responseText);
    alert($.ajax({type: "GET", url: '.',       async: false}).responseText);
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

直接访问文件时:$ firefox ex.html结果如上所述. $ firefox .显示:

文件索引:/// home/cwhii/work/jq/ex

到更高级别的目录

名称大小上次修改

ex.html 1 KB 03/24/2010 10:29:37 PM

jquery.js 161 KB 03/17/2010 05:16:58 PM

然后单击该ex.html链接将在第一个警报框中生成预期的文件内容,并在第二个警告框中生成目录列表.

总之,在命令行上使用文件名调用firefox不会生成目录列表,但是当通过目录页面上的链接导航到同一文件时,第二个警告框会显示列表.

此外,我以上述所有方式调用了Google Chrome浏览器5.0.307.11测试版,并且即使$ google-chrome .生成了目录列表页面,所有结果也未在警告框中 生成目录列表.

linux jquery google-chrome firefox3.5

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

NHibernate 3.0源代码库在哪里?

我一直在寻找各地.也许我只是在近视,但我似乎无法在任何地方找到它.链接任何人?

nhibernate

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