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>
Tuesday, November 3, 2009
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!
Subscribe to:
Posts (Atom)