Assuming you use a database, the best way is probably to write a stored procedure to do it - and enclose the whole operation in a transaction.
Then, within the transaction you can use
@@IDENTITY[
^] to fecth the value inserted in the first table, and insert it in the second.
But myself, I wouldn't use Identity values for this - I'd use a Guid value instead, and pass that through from the C# code.