How to set checked value for a radio input tag using ASP.Net?

I have this radio tag: <input name="phoneRadio" class="phoneRadio" id="rbDefaultPhone" type="radio" checked="<%# GetIsChecked(Eval("IsDefault")) %>"/> in a repeater and GetIsChecked is ac# function which return bool value, my problem that its not affecting the checked value of the radio button the right way, Any one know how to fix that? Just having the checked attribute on t

如何使用ASP.Net设置无线电输入标记的检查值?

我有这个无线电标签: <input name="phoneRadio" class="phoneRadio" id="rbDefaultPhone" type="radio" checked="<%# GetIsChecked(Eval("IsDefault")) %>"/> 在一个中继器和GetIsChecked是ac#函数,它返回布尔值,我的问题是它不会影响单选按钮的选中值正确的方式,任何人都知道如何解决这个问题? 只要在input上具有checked属性就足以使其被检查。 在HTML中,你只需要已checked在那里,在XHTML中,应c

Late binding in C# to Word Control in XAML/Store app

Previously I've been able to find a Word document inside another application using [DllImport("Oleacc.dll")] private static extern long AccessibleObjectFromWindow(int windowHandle, int objectID, Guid refID, ref IntPtr accessibleObject); and casting the resultant object returned into a Microsoft.Office.Interop.Word.Window This works pretty well in that I can inspect different properties ab

在C#中将后期绑定到XAML / Store应用程序中的Word控件

以前我一直能够在另一个应用程序中使用找到一个Word文档 [DllImport("Oleacc.dll")] private static extern long AccessibleObjectFromWindow(int windowHandle, int objectID, Guid refID, ref IntPtr accessibleObject); 并将返回的结果对象转换为a Microsoft.Office.Interop.Word.Window 这很有效,因为我可以在Microsoft Outlook中检查有关Word的不同属性,因为MS Outlook使用Word窗口呈现其电子邮件内容。 但是,它在

In C#, how to activate the previously focused window?

I work eg. in Firefox, and my C#.NET app brings its window to the front. That's ok, but when I use SendToBack() to hide the form, it doesn't activate Firefox's window, so altough Firefox is in the foreground, I have to click into the window to be able to scroll, etc. How can I activate the previously focused window in C#? i have tried these: [DllImport("User32")] private static e

在C#中,如何激活之前关注的窗口?

我工作,例如。 在Firefox中,我的C#.NET应用程序将它的窗口放在前面。 没关系,但是当我使用SendToBack()来隐藏表单时,它不会激活Firefox的窗口,所以尽管Firefox处于前台,但我必须点击窗口以便能够滚动,等等。如何激活以前关注的C#窗口? 我试过这些: [DllImport("User32")] private static extern int SetForegroundWindow(IntPtr hwnd); [DllImport("user32.dll")] static extern bool AllowSetForegroundWindo

Using Moq to mock an asynchronous method for a unit test

I am testing a method for a service that makes a Web API call. Using a normal HttpClient works fine for unit tests if I also run the web service (located in another project in the solution) locally. However when I check in my changes the build server won't have access to the web service so the tests will fail. I've devised a way around this for my unit tests by creating an IHttpClien

使用Moq模拟单元测试的异步方法

我正在测试一个提供Web API调用的服务的方法。 如果我也在本地运行Web服务(位于解决方案中的另一个项目中),则使用正常的HttpClient可以很好地进行单元测试。 但是,当我检查我的更改时,构建服务器将无法访问Web服务,因此测试将失败。 我已经为单元测试设计了一种方法,创建一个IHttpClient接口并实现我在我的应用程序中使用的版本。 对于单元测试,我使用模拟异步post方法完成了一个模拟版本。 这是我遇到问题的地方

Setting HttpContext.Current.Session in a unit test

I have a web service I am trying to unit test. In the service it pulls several values from the HttpContext like so: m_password = (string)HttpContext.Current.Session["CustomerId"]; m_userID = (string)HttpContext.Current.Session["CustomerUrl"]; in the unit test I am creating the context using a simple worker request, like so: SimpleWorkerRequest request = new SimpleWorkerRequest("", "", "", n

在单元测试中设置HttpContext.Current.Session

我有一个Web服务,我正在尝试单元测试。 在服务中,它从HttpContext提取几个值,如下所示: m_password = (string)HttpContext.Current.Session["CustomerId"]; m_userID = (string)HttpContext.Current.Session["CustomerUrl"]; 在单元测试中,我使用简单的工作请求创建上下文,如下所示: SimpleWorkerRequest request = new SimpleWorkerRequest("", "", "", null, new StringWriter()); HttpContext context = new Http

Mock HttpContext.Current in Test Init Method

I'm trying to add unit testing to an ASP.NET MVC application I have built. In my unit tests I use the following code: [TestMethod] public void IndexAction_Should_Return_View() { var controller = new MembershipController(); controller.SetFakeControllerContext("TestUser"); ... } With the following helpers to mock the controller context: public static class FakeControllerContext

在测试初始方法中模拟HttpContext.Current

我试图将单元测试添加到我构建的ASP.NET MVC应用程序中。 在我的单元测试中,我使用下面的代码: [TestMethod] public void IndexAction_Should_Return_View() { var controller = new MembershipController(); controller.SetFakeControllerContext("TestUser"); ... } 通过以下帮助程序来模拟控制器上下文: public static class FakeControllerContext { public static HttpContextBase FakeHttpContext(

ASP.NET single page authorization

I have an ASP.NET application where most of the pages are accessible to all authenticated users via a single sign on module that sets the username into the Session array variable. Now I have one folder A containing one page B.aspx and a list of usernames who are allowed to access this page B.aspx. My question: how do I elegantly authorize only these users for this one page, or better, for this

ASP.NET单页授权

我有一个ASP.NET应用程序,其中大部分页面都可以通过单一登录模块(可将用户名设置为Session数组变量)访问所有经过身份验证的用户。 现在我有一个文件夹A包含一个B.aspx页面和一个允许访问该页面B.aspx的用户名单。 我的问题:我如何优雅地授权这一个页面的这些用户,或者更好地为这个文件夹授权。 可以使用文件夹A中的Web.config文件中的位置标记完成吗? 如果是这样,我如何将该配置与自定义代码连接以检查存储在会话变

Protection not working for me

in my web.config file i've got the following: <authentication mode="Forms"> <forms name=".ASPXAUTH" protection="All" loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> But when i log in and watch the traffic with fiddler, i still can see the password in plain text. I have no idea whats wrong. Regards, matt I only know of two solutions to this: Use http

保护不适用于我

在我的web.config文件中我有以下内容: <authentication mode="Forms"> <forms name=".ASPXAUTH" protection="All" loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> 但是,当我登录并使用提琴手观看流量时,我仍然可以用纯文本查看密码。 我不知道什么是错的。 问候, 亚光 我只知道两个解决方案: 使用https。 最好的解决方案,安全。 使用JavaScript库(sha1)在发送密码之

Access to the path Denied when uploading excel file

When uploading an excel file I am receiving this error, can anyone help me? Access to the path 'C:DataIronElementsUploadAUMData20101202 031815.xlsx' is denied. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.U

上传Excel文件时访问路径被拒绝

上传Excel文件时,我收到此错误,任何人都可以帮助我吗? 访问路径'C: Data IronElements Upload AUMData 20101202 031815.xlsx'被拒绝。 说明:执行当前Web请求期间发生未处理的异常。 请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。 异常详细信息:System.UnauthorizedAccessException:拒绝访问路径“C: Data IronElements Upload AUMData 20101202 031815.xlsx”。 ASP.NET无权访问请

MSMQ listener with WCF?

Scenario : I want to implement an MSMQ in which users input message through System.Messaging API's. And there should be a listener which always observes this queue so when ever there is a message in queue I want to make a database updation. My first approach was to implement MSMQ trigger. I was able to implement a COM interop dll trigger. But I wasnt able to do database operation and I c

MSMQ监听与WCF?

场景:我想实现一个MSMQ,用户通过System.Messaging API输入消息。 并且应该有一个监听器总是观察这个队列,所以当队列中有消息时我想进行数据库更新。 我的第一个方法是实现MSMQ触发器。 我能够实现一个COM interop dll触发器。 但我不能做数据库操作,我无法弄清楚什么是错误的,我尝试了很多。 然后我开始了解这个WCF MSMQ绑定。 由于我对这个WCF很陌生,我有一些疑问。 这是为这种情况托管WCF的最佳方法。 它是与W