Chinaunix首页 | 论坛 | 博客
  • 博客访问: 489956
  • 博文数量: 33
  • 博客积分: 4168
  • 博客等级: 上校
  • 技术积分: 675
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-26 20:21
文章分类

全部博文(33)

文章存档

2013年(8)

2012年(2)

2011年(7)

2010年(1)

2009年(4)

2008年(11)

分类:

2008-09-09 23:10:53

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
 
 
阅读(2149) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~