我正在寻找一种方法,使用.NET 2.0(二进制)将PDF文件从我的服务器流式传输到浏览器.
我正试图从服务器路径中获取现有的PDF文件,并将其作为二进制文件推送到浏览器.
我有一个通用的概念证明WCF服务,它使用表单身份验证来保护访问.当我的客户端是.NET时,一切都很棒(下面的vb代码)
Dim client As SupplierServiceClient = New SupplierServiceClient()
client.ClientCredentials.UserName.UserName = "xxxx@xxx.xx.xx"
client.ClientCredentials.UserName.Password = "password"
Dim SupplierList As List(Of Supplier) = client.GetSuppliers()
Run Code Online (Sandbox Code Playgroud)
但是我希望这可以与任何可以执行SOAP 1.1/1.2的人互操作 - 如何连接PHP或Java客户端?
我的WCF web.config列在下面(fyi)
<system.serviceModel>
<services>
<service name="SampleApplicationWCF.Library.SupplierService" behaviorConfiguration="NorthwindBehavior">
<endpoint address="" name="wsHttpSupplierService" contract="SampleApplicationWCF.Library.ISupplierService" binding="wsHttpBinding" bindingConfiguration="wsHttp"/>
<endpoint address="https://server/SampleApplicationWCF/SupplierService.svc/Basic" name="basicHttpSupplierService" contract="SampleApplicationWCF.Library.ISupplierService" binding="basicHttpBinding" bindingConfiguration="basicHttp"/>
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
</service>
</services>
<bindings>
<wsHttpBinding>
<binding name="wsHttp">
<security mode="TransportWithMessageCredential">
<transport/>
<message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="true"/>
</security>
</binding>
</wsHttpBinding>
<basicHttpBinding>
<binding name="basicHttp">
<security mode="TransportWithMessageCredential">
<transport/>
<message clientCredentialType="UserName"/>
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="NorthwindBehavior"> …Run Code Online (Sandbox Code Playgroud) 我能想到的唯一例子是html - 如果你动态添加一个TR w /一个colspan + div,其中包含详细信息(可编辑),例如点击之前的TR
我正试图找到XAML,想看看是否有人能指出我这个古怪的要求正确的方向.
我似乎无法找到一篇好的博客文章,其中展示了如何在没有魔术字符串"ViewData"的情况下将模型绑定到视图(使用强类型视图是我正在尝试的方法)
有没有人知道我需要在下面改变什么来直接将它绑定到我的模型?
视图
<%@ Page Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of IEnumerable (Of MvcApplication1.Category))" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
<%=Html.DropDownList("CategoryList")%>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)
调节器
Function Index() As ActionResult
Dim list As New List(Of Category)
list.Add(New Category With {.CategoryID = 1, .CategoryName = "Test1"})
list.Add(New Category With {.CategoryID = 2, .CategoryName = "Test2"})
Return View()
End Function
Run Code Online (Sandbox Code Playgroud)
编辑
VB中的最终解决方案如下所示,感谢您的响应!
调节器
Function Index() As ActionResult
Dim id As Integer = 1
Dim ProductObject As Product = mProductService.GetProductById(id)
Return View(ProductObject)
End Function
Run Code Online (Sandbox Code Playgroud)
视图
<%=Html.DropDownList("Category", New SelectList(Model.Categories, "CategoryID", "CategoryName"))%> …Run Code Online (Sandbox Code Playgroud) 我正在尝试在特定类中的tr内的第一个td中添加一个类.但由于某种原因,它只将此类添加到第一个tr中的第一个t - 而不是每个tr中的第一个td
$("#appendTD").find("#gridFormInformation").children(0).children().each(
function() {
if ($("#appendTD").find('tr').filter(function() { return $(this).attr('class') == 'ui-widget-content ui-subtblcell'; }).children("td:eq(0)").addClass("leftbord"));
}
);
Run Code Online (Sandbox Code Playgroud)
但是当我通过删除""td:eq(0)来改变上面的内容时,它会将这个类添加到每个tr中的每个td ......所以我做错了什么?
下面的标记示例
<td id="appendTD">
<table id="gridFormInformation">
<tbody>
<tr><th>1</th><th>2</th><th>3</th></tr>
<tr class="ui-widget-content ui-subtblcell"><td>1</td><td>2</td><td>3</td></tr>
<tr class="ui-widget-content ui-subtblcell"><td>1</td><td>2</td><td>3</td></tr>
<tr class="ui-widget-content ui-subtblcell"><td>1</td><td>2</td><td>3</td></tr>
</tbody>
</table>
</td>
Run Code Online (Sandbox Code Playgroud) 如果我想使用一个对象并利用LINQ to SQL,我需要添加什么(如果有的话)我的实体类以确保我的应用程序可以与数据存储进行通信?(在这里不要讨论存储库模式,因为我只是在寻找业务对象中需要的内容)
目前我在需要的时候直接硬编码另一个对象,我希望能够通过init方法接受这个(我假设?).在下面的代码中,我在viewDidLoad方法中创建了一个新的HatService,出于可测试性/耦合的原因,我不想这样做.
- (void)viewDidLoad
{
[super viewDidLoad];
HatService* hatService = [[HatService alloc] init];
[hatService getHatById:self];
}
Run Code Online (Sandbox Code Playgroud)
第一个问题 - 如何在objective-c中完成?第二个问题 - 我应该担心这个还是做到这一点?
更新
这是我开始的,但我似乎从来没有在运行时遇到第一个init方法.我已经在界面中声明了 - 我错过的任何其他内容都允许我覆盖此init方法并注入服务依赖项?
注意 - 当我自己创建对象时,我可以手动点击这个,但是当appDeleage完成工作时我没有看到它(如果app委托创建这个对象而不调用我的init方法?)
-(id)initWithHatService:(HatService *)service
{
if (self = [super init])
{
[self setService:service];
}
return self;
}
-(id)init
{
HatService* hatService = [[HatService alloc] init];
return [self initWithHatService:hatService];
}
Run Code Online (Sandbox Code Playgroud) 我有一个带文本框和UIButton的简单视图.当我单击UIButton时,我只想隐藏当前在视图中的键盘.这是一个简单的委托我可以添加到控制器或更复杂的东西?
在SO上已经存在的答案中,我还没有找到一个对此上下文有完整解决方案的答案.任何帮助都会很棒!
我需要将以下字符串放入日期时间
星期六,2011年5月21日21:31:35 GMT
到目前为止,我正在做以下事情,但我不确定解析它的有效格式.任何帮助,将不胜感激!
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date date = df.parse("Sat, 21-May-2011 21:31:35 GMT");
Run Code Online (Sandbox Code Playgroud)
先感谢您
我有一个包含一个简单按钮的ItemTemplate.当我单击此按钮时,我需要一种方法来识别单击的行以拉出绑定到列表框的项目.
XAML
<ListBox Name="DemoBox" SelectionChanged="listBox_SelectionChanged">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Height="150">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="400"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid Height="120" Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Text="{Binding SomeObjProperty}"/>
</Grid>
<Grid Height="120" Grid.Column="1" Margin="0,-12,0,0">
<Button Click="ShowStuffOnMap_Click">
<Button.Background>
<ImageBrush ImageSource="images/arrow.png"/>
</Button.Background>
</Button>
</Grid>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
Run Code Online (Sandbox Code Playgroud)
点击处理程序
private void ShowStuffOnMap_Click(object sender, RoutedEventArgs e)
{
//sender is the button so ...
}
Run Code Online (Sandbox Code Playgroud)
先感谢您
.net ×2
asp.net-mvc ×1
cocoa-touch ×1
data-binding ×1
datetime ×1
formatting ×1
html ×1
html-table ×1
interop ×1
java ×1
jquery ×1
linq-to-sql ×1
objective-c ×1
security ×1
wcf ×1
wpf ×1
xaml ×1