首页 \ 问答 \ asp.net登录并加载登录用户的用户详细信息(asp.net Login and load user details for the user who is logged in)

asp.net登录并加载登录用户的用户详细信息(asp.net Login and load user details for the user who is logged in)

我遇到了一个小问题。 到目前为止,我的应用程序使用sql server datbase验证用户登录凭据,并将它们重定向到welcome.aspx页面。 我还创建了一个'PlayerDetails.aspx'页面,我想在txt框中显示他们的个人详细信息(在注册过程中获得)。

我觉得我在这里有一个非常明显的空白时刻但是如何在登录阶段创建一个player.cs对象,并在PlayerDetails.aspx页面上使用该对象来填充字段?

我的代码片段如下,但如果您需要进一步说明,请告知我们。

谢谢杰森

登录页面

protected void btnLogin_Click(object sender, EventArgs e)
    {
        userlogin = new userlogin(txtUserName.Text, txtPassword.Text);

        var exists = login.ValidateLogin();
        if (exists == 1)
        {         
            //shall I create a new 'Player.cs' object here??
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, false);
        }
        else
        {

            lblMessage.Text = "Invalid username and/or password";
        }
    }

Player.cs

我的数据库包含每个唯一GUID的值

public class Player : Credentials
{
    public Guid AccountID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Email { get; set; }
}

PlayerDetails.aspx

<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">
<table>
    <tr>
        <td>First Name</td>
        <td><asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox></td>
    </tr>

    <tr>
        <td>Last Name</td>
        <td><asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
    </tr>

    <tr>
        <td>Last Name</td>
        <td><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
    </tr>
</table>

PlayerDetails.aspx.cs

 protected void Page_Load(object sender, EventArgs e)
    {
        //id like to set the values of the txt boxes to those in my Player object, not yet created
    }

i've hit a minor problem. My application so far verifies a users login credentials using a sql server datbase and redirects them to a welcome.aspx page. I've also created a 'PlayerDetails.aspx' page which I'd like to use for displaying their personal details (obtained during the registration process) in txt boxes.

I feel like I'm having a very obvious blank moment here but how do a create a player.cs object at the login stage, and use that object on the PlayerDetails.aspx page, to populate the fields?

My code snippets are below, but if you require further clarification please let me know.

thanks Jason

Login Page

protected void btnLogin_Click(object sender, EventArgs e)
    {
        userlogin = new userlogin(txtUserName.Text, txtPassword.Text);

        var exists = login.ValidateLogin();
        if (exists == 1)
        {         
            //shall I create a new 'Player.cs' object here??
            FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, false);
        }
        else
        {

            lblMessage.Text = "Invalid username and/or password";
        }
    }

Player.cs

My database contains the values per unique GUID

public class Player : Credentials
{
    public Guid AccountID { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Email { get; set; }
}

PlayerDetails.aspx

<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">
<table>
    <tr>
        <td>First Name</td>
        <td><asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox></td>
    </tr>

    <tr>
        <td>Last Name</td>
        <td><asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
    </tr>

    <tr>
        <td>Last Name</td>
        <td><asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
    </tr>
</table>

PlayerDetails.aspx.cs

 protected void Page_Load(object sender, EventArgs e)
    {
        //id like to set the values of the txt boxes to those in my Player object, not yet created
    }

原文:https://stackoverflow.com/questions/22385319
更新时间:2021-11-28 21:11

最满意答案

此时,您需要查看服务器上的存储库以确定问题所在,并且您可能需要与BitBucket技术支持人员交谈。 但是你的描述听起来就像你的仓库里有一些可以清理的垃圾。

考虑你是否已经将一些500 MB文件推送到BitBucket存储库。 现在你意识到你的错误,并以某种方式从你的版本库中删除它(例如BFG)并推送更新后的文件。 您远程的ref将被更新为指向新的提交,并且您的存储库不会包含大文件(如果您克隆了存储库,则不会获得大文件)。

但是远程程序不会删除旧提交或该提交中的旧文件。 它只会将它与图表断开,并且该大文件将不再“可达”。 实际上,它将是“垃圾”,符合“垃圾收集”的条件。 这会删除大文件,并且服务器上的存储库大小会缩小。

无法向服务器询问GC(通过git协议)。 BitBucket的支持应该能够为您执行此操作:

您需要寻找我们才能触发gc。 我认为最好的办法是在紧急情况下“升级”它,我们应该能够立即得到它。 - Bitbucket支持(2016年12月)

请注意,这假设您本地实际拥有完整的存储库,请确保执行fetch --all以确保本地没有可访问的历史记录子集。 在BFG的情况下,确保您使用--mirror选项克隆了您的存储库。


At this point you would need to look at the repository on the server to know with certainty what the problem is, and you will likely need to talk to BitBucket technical support. But your description makes it sound like your repository has some garbage in it that can be cleaned up.

Consider if you had pushed some 500 MB file up to your BitBucket repository. Now you realize your error, and remove it from your repository in some way (BFG, for example) and push that updated ref. The ref on your remote will be updated to point to the new commit, and your repository will not appear to contain the big file (if you cloned your repository, you would not get the big file).

But the remote would not have gone and deleted the old commit or the old file in that commit. It would merely disconnect it from the graph, and that large file would no longer be "reachable". It would, in fact, be "garbage" eligible for "garbage collection". This would delete the big file and your repository size on the server would shrink.

There is no way to ask the server to GC (over the git protocol). BitBucket's support should be able to perform this for you:

You'll need to look for us to trigger the gc instead. I guess the best way is to "escalate" it if it is really urgent, and we should be able to get to it immediately. — Bitbucket Support (Dec. 2016)

Note that this assumes that you actually have the full repository locally, make sure to do a fetch --all to ensure that you don't have a subset of (reachable) history locally. In case of BFG, make sure you've cloned your repository with the --mirror option.

相关问答

更多
  • 为了有效地更新数据库的开发人员副本, rsync可能是一个很好的选择。 它使用增量算法来递增更新文件。 这样它只会传输已更改或新的文件块。 他们当然仍然需要先下载完整的文件,但后来的更新会更快。 从本质上讲,你可以得到一个类似的增量更新作为git fetch,而不需要git克隆会提供的不断扩展的初始副本。 损失没有历史,但听起来像你不需要那样。 rsync是大多数Linux发行版的标准部分,如果你需要它在Windows上有一个打包的端口可用: http : //itefix.no/cwrsync/ 要将数据 ...
  • 此时,您需要查看服务器上的存储库以确定问题所在,并且您可能需要与BitBucket技术支持人员交谈。 但是你的描述听起来就像你的仓库里有一些可以清理的垃圾。 考虑你是否已经将一些500 MB文件推送到BitBucket存储库。 现在你意识到你的错误,并以某种方式从你的版本库中删除它(例如BFG)并推送更新后的文件。 您远程的ref将被更新为指向新的提交,并且您的存储库不会包含大文件(如果您克隆了存储库,则不会获得大文件)。 但是远程程序不会删除旧提交或该提交中的旧文件。 它只会将它与图表断开,并且该大文件将 ...
  • 好的,这些评论是了解问题根本原因的一个很好的开始。 虽然我不太了解git filter-branch命令,所以我对使用它有点谨慎。 我遇到了这个工具: http : //rtyley.github.com/bfg-repo-cleaner/ 它创造了奇迹。 我的回购现在低于10MB。 Ok, the comments were a great start to understand what the root cause of the problem probably was. I don't really ...
  • git config --global http.postBuffer 524288000 git clone repo_url --depth 1 我已经按照上面的步骤,最后我成功地克隆了我的代码。 git config --global http.postBuffer 524288000 git clone repo_url --depth 1 I have followed above steps and finally I have successfully cloned my code.
  • 我发现这个脚本在过去非常有用,可以在git仓库中找到大型(非显而易见的)对象: http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/ #!/bin/bash #set -x # Shows you the largest objects in your repo's pack file. # Written for osx. # # @see ...
  • 看起来Git LFS主要是用于更新/删除。 Git-LFS主要是保持存储库的大小。 git clone通常会下载整个存储库,所以git-lfs通常会影响clone 。 存储库包含所有文件和这些文件的所有版本, 包括已删除的文件。 如果你做了一个小的Ubuntu更新和git rm ubuntu-16.04.4-server-amd64.iso和git add ubuntu-16.04.5-server-amd64.iso现在你存储了两个ISO。 另一个更新,它是三个。 然后四个。 五。 六。 没有git-lf ...
  • 快速谷歌搜索给了我这个bash脚本 。 我相信这应该适用于github。 #!/bin/bash set -o errexit # Author: David Underhill # Script to permanently delete files/folders from your git repository. To use # it, cd to your repository's root and then run the script with a list of paths # you ...
  • 你有没有尝试过运行git gc ? http://www.kernel.org/pub/software/scm/git/docs/git-gc.html Have you tried running git gc? http://www.kernel.org/pub/software/scm/git/docs/git-gc.html
  • 据我所知,没有任何可以被认为是“最佳”的设置。 大多数人推荐使用某种外部资产管理。 就我个人而言,我会把文件放在一个ftp服务器上,并带有YYYYMMDD ##扩展名,然后在我的git仓库中有一个小脚本,用于检查我是否拥有正确的版本并下载它,如果我不这样做,并检查脚本饭桶。 这样,您仍然可以将源代码的版本与您的二进制资源的正确版本进行匹配,但这不会减慢您的git操作。 To my knowledge there isn't really any setting that can be considered ...
  • 如果在执行第一个命令时没有初始化repo,则错误消息是正常的:您需要在添加任何远程之前创建一个repo。 至于你的第二个错误信息:如果你在git repo目录本身(你在git init ),那么,作为Issac注释,你不需要--git-dir参数。 但是如果你仍然想添加一个--git-dir参数,那么--git-dir为非裸存储库引用的路径必须以/.git (就像你在第一个命令中所做的那样)。 即使在~/gitRepo/my_repo创建了一个git repo: ~/gitRepo/my_repo不是git ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)