To enable Https for WCF, you need to change the config in the service site. For host in IIS, you need to make sure do not assign the name to bindings/[binding type]/binding and do not assign binding name in services/service/endpoint. Below is the sample:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="HttpsBehavior" >
<serviceMetadata httpsGetEnabled="true" httpGetEnabled="true" policyVersion="Policy12"/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="TestService" behaviorConfiguration="HttpsBehavior" >
<endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
<endpoint
address=""
binding="basicHttpBinding" "No Bindding Name here"
contract="mProductive.PortalAdmin.WebSite.IWebPurchase"
/>
</service>
</services>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" >
<baseAddressPrefixFilters>
<add prefix="http://localhost/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
<bindings >
<basicHttpBinding>
<binding "No Bindding Name here">
<security mode="Transport">
<transport clientCredentialType="None"/></security>
</binding>
</basicHttpBinding>
</bindings>
</system.serviceModel>
Sunday, July 3, 2011
Tuesday, November 3, 2009
supportsMaintainScrollPositionOnPostback On Chrome
Add a new file called others.browser to the app_browser folder. This can also fix the asp.net Menu control under chrome. The file content as below:
<browsers>
<browser id="Safari3" parentID="Safari1Plus">
<identification>
<userAgent match="Safari/\d+\.\d+" />
</identification>
<capture>
<userAgent match="Version/(?'version'\d+\.\d+)" />
</capture>
<capabilities>
<capability name="browser" value="Safari3" />
<capability name="version" value="${version}" />
</capabilities>
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu"
adapterType="" />
</controlAdapters>
</browser>
<browser id="GoogleChrome" parentID="Safari3">
<identification>
<userAgent match="Chrome/(?'version'\d+\.\d+)" />
</identification>
<capabilities>
<capability name="browser" value="Googlebot" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
</capabilities>
</browser>
</browsers>
<browsers>
<browser id="Safari3" parentID="Safari1Plus">
<identification>
<userAgent match="Safari/\d+\.\d+" />
</identification>
<capture>
<userAgent match="Version/(?'version'\d+\.\d+)" />
</capture>
<capabilities>
<capability name="browser" value="Safari3" />
<capability name="version" value="${version}" />
</capabilities>
<controlAdapters>
<adapter controlType="System.Web.UI.WebControls.Menu"
adapterType="" />
</controlAdapters>
</browser>
<browser id="GoogleChrome" parentID="Safari3">
<identification>
<userAgent match="Chrome/(?'version'\d+\.\d+)" />
</identification>
<capabilities>
<capability name="browser" value="Googlebot" />
<capability name="supportsMaintainScrollPositionOnPostback" value="true" />
</capabilities>
</browser>
</browsers>
Wednesday, October 28, 2009
Clear ASP.Net Session from another ASP site
We have a 2 web app under our web site, one is asp.net and another one is asp. After user logout from the ASP web app, we need to make sure the ASP.Net site also been logout.
First we try to use Response.Cookie to delete the ASP.NET_SessionId cookie which issued by ASP.Net, but ASP will automatically encode the ASP.NET_SessionId to ASP%2ENET%5FSessionId which will add a new cookie.
So finally we use the Response.AddHeader "Set-Cookie","ASP.NET_SessionId=deleted;Path=/" to solve the problem
Write Cookie without Encode from ASP
In ASP, if you using Server.Cookie to add or change any cookie, the name and value of the cookie will be urlencode by ASP automatically. So if you call Server.Cookie("my.cookie") = "my_cookie", then on the browser, you will get my%2Ecookie = my%5Fcookie.
So you can use Response.AddHeader "Set-Cookie", "my.cookie=my_cookie" and you will get exact the name and value on your browser.
Monday, March 30, 2009
Get Windows Account For ASP.Net 2.0
Under ASP.Net 2.0, if you choose windows Authentication
1. In Web.config, set Authentication mode="Windows"
2. In IIS, set the security
2.1 Clear Anonymous
2.2 Choose Integrated Windows Authentication or
2.3 Use Client Certification and Map it to a windows account
Then in the Code, Get the windows Account as below
1. WindowsIdentity myIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal myPrincipal = new WindowsPrincipal(myIdentity);
The myPrincipal is the current account that ASP.Net running on
2. HttpContext.Current.Request.LogonUserIdentity
This is the account for the current visit account
3. HttpContext.Current.User.Identity and Thread.CurrentPrincipal.Identity are always Emtpy!
1. In Web.config, set Authentication mode="Windows"
2. In IIS, set the security
2.1 Clear Anonymous
2.2 Choose Integrated Windows Authentication or
2.3 Use Client Certification and Map it to a windows account
Then in the Code, Get the windows Account as below
1. WindowsIdentity myIdentity = WindowsIdentity.GetCurrent();
WindowsPrincipal myPrincipal = new WindowsPrincipal(myIdentity);
The myPrincipal is the current account that ASP.Net running on
2. HttpContext.Current.Request.LogonUserIdentity
This is the account for the current visit account
3. HttpContext.Current.User.Identity and Thread.CurrentPrincipal.Identity are always Emtpy!
Friday, November 14, 2008
ASP.Net Get Other Page's Resource
In ASP.Net, if you want to get other page's resource, you need to use the httpContext.GetLocalResourceObject and pass the page's relative path and the resource Name. For example HttpContext.GetLocalResourceObject("~/AnotherPage.aspx","Title")
Subscribe to:
Posts (Atom)