I am trying to send the userId (which is a uniqueidentifier in the db) in a querystring. The receiving
masterpage will then show data based on the user id. However, i am getting the error
'Conversion failed when converting from a character string to uniqueidentifier'

I thought converting guid to string and then comparing would work....when (using this code) i change the URL to be
/Login.aspx/?UserId=[some userid]
it works fine

Here is the code for the login..

<asp:Login ID="Login1" runat="server" BackColor="#EFF3FB" BorderColor="#B5C7DE" BorderPadding="4"
                BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em"
                ForeColor="#333333" DestinationPageUrl="~/Login.aspx?UserId=<% getUserId(); %>">
                <TitleTextStyle BackColor="#507CD1" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
                <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
                <TextBoxStyle Font-Size="0.8em" />
                <LoginButtonStyle BackColor="White" BorderColor="#507CD1" BorderStyle="Solid" BorderWidth="1px"
                    Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" />

Here is the code behind for getuserid()

protected string getUserId()
        MembershipUser myObject = Membership.GetUser();
        string userId = myObject.ProviderUserKey.ToString();
       return new Guid(userId).ToString("D");


it should see if the user is logged in and then return their userid.....then using the login code this should be
appended as a query string where the next piece of code will get filenames based on this.

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                        SelectCommand="SELECT [fileName], [dateModified], [UserId] FROM [Files] WHERE ([UserId] = @UserId)">
                            <asp:QueryStringParameter Name="UserId" QueryStringField="UserId" Type="String" />

this will come out onto a gridview.

im used asp 2.0 sqlserver 2005.

please help!! how do i do this?

I think the problem is that Guid(userId).ToString("D");
just use Guid(userId)..Tostring() or even just use return userId ,

if you have problem we are 24 hours online on expvice.com