Q:
I have an application that uses the windows userid for
authentication (single sign on).
The website property 'anonymous'is disabled and 'windows
authentication' is enabled.
I made an private assembly with VS2005 containing the next
class:
******************
using System;
using System.Web;
namespace NetPB
{
public class User
{
private string name;
public User()
{
}
public string GetName()
{
return HttpContext.Current.User.Identity.Name.ToString();
}
}
}
******************
This works fine in an VS2005 ASP.NET app but it returns an
empty string in an PB.net.webform. I added the assembly to
the assembly list and coded in Powerscript as follows :
******************
#if defined PBWEBFORM then
NetPB.@User usernet
usernet = create NetPB.@User
ls_tmp = usernet.GetName();
sle_user.text = ls_tmp
#end if
******************
Any suggestions ?
Regards,
Johan Bakker
A:
I found the cause of the problem. In the web.config of the
pb webform app the setting
and
it should be . After
correcting if, the next time I deploy the setting is back to
. So the question is now how to
prevent this behaviour, any idea's ?
A:
Copy the web.config file as web1.config in the same
directory. Then in the Post-build tab page of the project
put something like this,
copy C:\Inetpub\wwwroot\(application name)\web1.config
C:\Inetpub\wwwroot\(application name)\web.config
Hope this helps.
Bhaskar Singaravadivelu
阅读(2157) | 评论(0) | 转发(0) |