我在虚拟目录上运行一个网站.
该网站的网址是 http://localhost/virtalDirectory/pages.aspx
我有一个图像从以下目录heirarchy加载到页面上:
parent directory
..images
....my image
..myPage.aspx
我的img标签是
<img src="images/imageName.gif" alt="some text"/>
在IE8中加载时,图像正确加载,但在Firefox3中加载时,系统会提示我登录localhost,它似乎是一个Windows文件浏览器登录.
我在images目录中有一个web.config:
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
<img src="~/images/imageName.gif" alt="some text" runat="server"/> to allow asp to resolve the address of the image at run-time. Which does not resolve the problem.
http://localhost/virtalDirectory/pages.aspx到图像目录web.config.哪个不能解决问题.
为什么将数据存储在文件的appSettings元素(或自定义部分内)中web.config比将其存储在类中更好?
一个论点是,通过使用自定义部分,我们不必在更改数据时重新编译代码,但这是一个弱论点,特别是如果我们使用网站,每当代码更改时自动重新编译!
谢谢
所以我试着在配置中读取.Perl中的文件.配置文件使用尾部反斜杠来表示行继续.例如,文件可能如下所示:
=== somefile ===
foo=bar
x=this\
is\
a\
multiline statement.
Run Code Online (Sandbox Code Playgroud)
我有读取文件的代码,然后处理尾随反斜杠以连接行.但是,看起来Perl已经为我做了.例如,代码:
open(fh, 'somefile');
@data = <fh>;
print join('', @data);
Run Code Online (Sandbox Code Playgroud)
打印:
foo=bar
x=thisisamultiline statement
Run Code Online (Sandbox Code Playgroud)
瞧,'@ dat =;' 声明似乎已经处理了反斜杠!
这是Perl中定义的行为吗?
我正在使用Windows 7 Pro并希望在本地运行我的Web项目,但该URL www.localhost.com不起作用.
如果使用http://127.0.0.1:2710/default.aspx它有效.我检查了C:\Windows\System32\Drivers\Etc\hosts文件夹中的主机文件.如果我删除行:
# 127.0.0.1 localhost
# ::1 localhost
Run Code Online (Sandbox Code Playgroud)
没有什么变化.如何让www.localhost.com在我的机器上运行?
如何在命令行中更改Emac的默认字体大小,而不是emacs的X版本?
我犯了一个愚蠢的错误......
我在XP中设置区域设置之前安装了.Net,现在DateTime.Now将日期设置为12/01/2009而不是01/12/2009.
我确信有一种简单的方法可以为.Net运行时配置更改它,但我不记得它是什么.
救命?
使用BitNami在我的Windows 7 Ultimate 64bits上安装Trac后,我遇到了一些问题.问题是:
Subversion控件在安装过程中,当BitNami设置要求提供项目存储库目录时,它只接受您编写不存在的路径,否则无法继续.所以我被迫将路径指向"C:\ Repositories\TRAC"(一个新文件夹)而不是"C:\ Repositories\DBG"(我正在创建的项目的存储库).因此,在安装之后,我已经在密钥处更改了trac.ini文件
[trac]
repository_dir = C:\Repositories\TRAC
repository_type = svn
Run Code Online (Sandbox Code Playgroud)至
[trac]
repository_dir = C:\Repositories\DBG
repository_type = svn
Run Code Online (Sandbox Code Playgroud)
现在,当我在Trac中登录DBG项目时,它警告:
警告:无法与存储库同步('repository_dir'已更改,需要'trac-admin resync'操作.).查看Trac日志以获取更多信息.
当我去cmd时会发生以下情况:
C:\Users\Fernando>cd\
C:\>cd C:\Program Files\BitNami Trac Stack\trac\Scripts
C:\Program Files\BitNami Trac Stack\trac\Scripts>trac-admin resync
Welcome to trac-admin 0.11.6
Interactive Trac administration console.
Copyright (c) 2003-2009 Edgewall Software
Type: '?' or 'help' for help on commands.
Trac [C:\Program Files\BitNami Trac Stack\trac\Scripts\resync]> resync
Failed to open environment. [Errno 2] No such file or directory: 'C:\\Program Fi
les\\BitNami Trac Stack\\trac\\Scripts\\resync\\VERSION' …Run Code Online (Sandbox Code Playgroud) 我想使用连接字符串App.Config文件.也可以使用NHibernate连接到2个数据库(不同的连接字符串),如果是这样的话怎么样?
我的公司的互联网在代理服务器上使用身份验证(即每次我尝试访问任何网页时,浏览器会提示用户名/密码窗口).
现在我有一些试图访问互联网的Windows应用程序(如用于rss供稿的WebPI/Visual Studio 2008),但由于它们无法弹出验证窗口,因此它们无法通过错误连接到互联网:
(407)需要代理验证
.这里的例外是VS2008,第一次总是无法在启动页面上加载rss feed,但是当我点击链接时,它会显示身份验证窗口,之后一切正常.
我的问题是:我如何配置正常的Windows应用程序(通过app.config/app.manifest文件)访问Web,以显示身份验证窗口或提供默认凭据.
为了探索这个角度,我在VS2008上创建了一个控制台应用程序,它试图在谷歌上搜索一些东西并在控制台上显示结果.码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace WebAccess.Test
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Enter Serach Criteria:");
string criteria = Console.ReadLine();
string baseAddress = "http://www.google.com/search?q=";
string output = "";
try
{
// Create the web request
HttpWebRequest request = WebRequest.Create(baseAddress + criteria) as HttpWebRequest;
// Get response
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)
{
// Get the response stream
StreamReader reader …Run Code Online (Sandbox Code Playgroud) 我想在稍微不同的场景中实现Craig Andera的自定义XML配置处理程序.我想要做的是读入任意长度的自定义对象列表,定义如下:
public class TextFileInfo
{
public string Name { get; set; }
public string TextFilePath { get; set; }
public string XmlFilePath { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我设法为一个自定义对象复制了Craig的解决方案,但如果我想要几个呢?
Craig的反序列化代码是:
public class XmlSerializerSectionHandler : IConfigurationSectionHandler
{
public object Create(object parent, object configContext, XmlNode section)
{
XPathNavigator nav = section.CreateNavigator();
string typename = (string)nav.Evaluate("string(@type)");
Type t = Type.GetType(typename);
XmlSerializer ser = new XmlSerializer(t);
return ser.Deserialize(new XmlNodeReader(section));
}
}
Run Code Online (Sandbox Code Playgroud)
如果可以的话,我想我能做到这一点
Type t = Type.GetType("System.Collections.Generic.List<TextFileInfo>")
Run Code Online (Sandbox Code Playgroud)
工作,但它抛出
Could not load type 'System.Collections.Generic.List<Test1.TextFileInfo>' …Run Code Online (Sandbox Code Playgroud) configuration ×10
asp.net ×3
c# ×3
.net ×2
app-config ×1
bitnami ×1
bug-tracking ×1
command ×1
date ×1
emacs ×1
firefox ×1
fonts ×1
format ×1
hosts ×1
image ×1
loopback ×1
nhibernate ×1
perl ×1
proxy ×1
security ×1
trac ×1
web-config ×1
windows ×1
windows-7 ×1